Accessibility for Nested Text in react native

I am trying to implement Accessibility for react native application. I have 2 nested Text Tags, If I enable the accessibility for all Text Tags, It is highlighting the first Text Tag.

I enabled in all 2 Text tags, but only first Text tag is visible for Accessibility

<Text accessible={true} accessibilityLabel={'Hello'} >Hello
 <Text accessible={true} accessibilityLabel={'Stack Devs!'}>Stack Devs! 
 </Text>
</Text>

I need to make the second Text accessible. As of now only first Text is accessible

Upvotes: 0

Views: 743

Answers (1)

Samuli Hakoniemi
Samuli Hakoniemi

Reputation: 19049

I had same problem recently. Only proper way to do it on RN, is to have the whole string in one property:

<Text accessible={true} accessibilityLabel={'Hello Stack Devs!'}>
  {'Hello'}
  <Text>{'Stack Devs!'}</Text>
</Text>

Upvotes: 1

Related Questions