Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Text] [Android] numberOfLines prop WITH textAlign style breaks onPress in Nested Text #27624

Closed
jlflanders opened this issue Dec 27, 2019 · 2 comments
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@jlflanders
Copy link

jlflanders commented Dec 27, 2019

On Android, nested Text elements do not support onPress if their parent has the numberOfLines prop AND the textAlign style. Removing either numberOfLines or textAlign allows for the nested Text element's onPress to work properly. iOS works as expected.

Possibly related to #22811 (Text numberOfLines prop is not respected in Nested Text) except numberOfLines prop is operating as expected in this case.

React Native version:
originally found on 0.59.10
reproduced on Snack on 0.61.4

Steps To Reproduce

  1. In your render function, return the following:
<View style={styles.container}>
  <Text style={styles.paragraph} numberOfLines={1}>
    <Text onPress={() => Alert.alert('ow you poked my text')}>
    Change code in the editor and watch it change on your phone! Save to get a shareable url.
    </Text>
  </Text>
</View>
  1. In styles.paragraph set textAlign: 'center'
  2. When clicking on the truncated link Change code in the editor and watch..., nothing happens.
  3. Remove ONLY the textAlign style or ONLY the numberOfLines prop.
  4. Now, clicking on the link causes a pop up with ow you poked my text.

Describe what you expected to happen:
When clicking on the truncated link Change code in the editor and watch... that is center aligned, a pop up with ow you poked my text should appear.

Snack, code example, screenshot, or link to a repository:
https://snack.expo.io/Sk8ZPAmk8

@jlflanders jlflanders added the Bug label Dec 27, 2019
@react-native-bot react-native-bot added the Platform: Android Android applications. label Dec 27, 2019
@jlflanders jlflanders changed the title Text numberOfLines prop WITH textAlign set breaks onPress in Nested Text on Android [Text] [Android] numberOfLines prop WITH textAlign style breaks onPress in Nested Text Dec 27, 2019
@stale
Copy link

stale bot commented Mar 26, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 26, 2020
@stale
Copy link

stale bot commented Apr 2, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Apr 2, 2020
@facebook facebook locked as resolved and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants