react-native-selectable-text icon indicating copy to clipboard operation
react-native-selectable-text copied to clipboard

onPress not working for children

Open kirtan96 opened this issue 5 years ago • 3 comments

I have the following code: <SelectableText selectable={true} menuItems={["Add to note", "Comment"]} onSelection={(props) => { console.log(props) alert(props.eventType + ": " + props.content) }} style={{margin: 20}} appendToChildren={ <Text> Hello <Text onPress={() => alert('Hello World')} style={{fontWeight: 'bold'}}>World</Text> </Text> } /> Screen Shot 2020-06-13 at 6 43 56 PM

and it outputs the text correctly, however, the onPress of Text component (on word: "World") does not work. If I were to have same "Hello World" Text Component outside of SelectableTextComponent, the onPress works fine.

kirtan96 avatar Jun 14 '20 01:06 kirtan96

the same issue, maybe edit RNSelectableText flies can be solved

alooooooone avatar Sep 10 '20 11:09 alooooooone

I'm trying to do something similar. I think it's related to SelectableText essentially being a TextInput under the hood. The same thing happens if you simply do:

<TextInput>
  <Text onPress={() => console.log('hello')}>Some text</Text>
</TextInput>

I can't even get it to work with a trivial example like that. Would be happy if anyone had thoughts!

sbatson5 avatar Dec 15 '20 19:12 sbatson5

This appears to be a duplicate of https://github.com/Astrocoders/react-native-selectable-text/issues/47 In that issue, they point out the issue is only affecting iOS. I was able to confirm that I'm only seeing the issue on iOS, not Android. @georgelima I vote we close this issue to keep the discussion in #47

nsantacruz avatar Jan 18 '21 08:01 nsantacruz