Astrocoders / react-native-selectable-text

Capture text selection and customize the action menu
MIT License
224 stars 96 forks source link

onPress not working for children #55

Open kirtan96 opened 4 years ago

kirtan96 commented 4 years ago

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={

Hello alert('Hello World')} style={{fontWeight: 'bold'}}>World
            </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.

alooooooone commented 4 years ago

the same issue, maybe edit RNSelectableText flies can be solved

sbatson5 commented 3 years ago

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!

nsantacruz commented 3 years ago

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