Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

onPress not working for children #55

Open
kirtan96 opened this issue Jun 14, 2020 · 3 comments
Open

onPress not working for children #55

kirtan96 opened this issue Jun 14, 2020 · 3 comments

Comments

@kirtan96
Copy link

kirtan96 commented Jun 14, 2020

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.

@alooooooone
Copy link

the same issue, maybe edit RNSelectableText flies can be solved

@sbatson5
Copy link

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
Copy link
Contributor

This appears to be a duplicate of #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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants