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

onPress event for child nodes seem to get blocked on iOS #47

Open
jonasfrid opened this issue Feb 6, 2020 · 2 comments
Open

onPress event for child nodes seem to get blocked on iOS #47

jonasfrid opened this issue Feb 6, 2020 · 2 comments

Comments

@jonasfrid
Copy link

Hi there! This is a great library, although I'm having some trouble with nested, styled components inside a SelectableText.

I'm doing the following:

 <SelectableText
        value={textElements}
        style={style}
        menuItems={[
         'foo',
         'bar'
        ]}
        onSelection={this.pressedSelection}
      />

where textElements is an array of <Text onPress={myOnPressFn} style={{myStyle}}> elements with custom styles and highlights. However, myOnPressFn does not get called on iOS, only on Android. Why might this be?

Kind regards,
Jonas

@jonasfrid jonasfrid changed the title onPress events for child nodes seem to be blocked onPress events for child nodes seem to get blocked on iOS Feb 6, 2020
@jonasfrid jonasfrid changed the title onPress events for child nodes seem to get blocked on iOS onPress event for child nodes seem to get blocked on iOS Feb 6, 2020
@kimhung2
Copy link

Hello,
We are facing this same issue. onPress doesn't do anything on iOS, does anyone have a solution for this issue?

@nsantacruz
Copy link
Contributor

As @sbatson5 pointed out in the duplicate of this issue (#55), this seems to be a limitation because SelectableText on iOS is using TextInput (if I'm understanding this line correctly although I readily admit my Objective C is not strong)
The Android native view however is inheriting from TextView and seems to pass onPress events correctly to its children

Is there a reason the iOS native view is built on top of TextInput instead of TextView?

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

3 participants