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

[Nested Text Android] onPress hitbox has an incorrect size. #22747

Closed
3 tasks done
bobsmits opened this issue Dec 21, 2018 · 14 comments
Closed
3 tasks done

[Nested Text Android] onPress hitbox has an incorrect size. #22747

bobsmits opened this issue Dec 21, 2018 · 14 comments
Labels
Bug Platform: Android Android applications.

Comments

@bobsmits
Copy link

Environment

Run react-native info in your terminal and paste its contents here.

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
      Memory: 55.39 MB / 8.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.11.2 - /usr/local/bin/node
      Yarn: 1.3.2 - /usr/local/bin/yarn
      npm: 5.6.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 25, 26, 27
        Build Tools: 23.0.1, 26.0.3, 27.0.3, 28.0.3
        System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.1 AI-173.4720617
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3 
      react-native: 0.57.8 => 0.57.8 
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1

Description

Nested Texts with an onPress do not allow you te press on the whole word. Texts nested in a View work correctly. This only happens on Android IOS seems fine.

large gif 424x860

Reproducible Demo

Init a new react native project. Change default App component to:

 <View style={styles.container}>
    <Text>
        <Text onPress={ () => {console.warn('Hello!')} } style={styles.welcome}>facebook.com</Text>
    </Text>
 </View>

The last letter from facebook.com will not respond to the onPress.

A Text nested directly in a View it works as expected:

 <View style={styles.container}>
     <Text onPress={ () => {console.warn('Hello!')} } style={styles.welcome}>facebook.com</Text>
 </View>
@cpojer
Copy link
Contributor

cpojer commented Apr 2, 2019

You are right, this seems like this is a real issue but unfortunately it's unlikely anyone will be able to spend time on this anytime soon. Do you wanna send a PR to fix this?

@kevinavery
Copy link

kevinavery commented Jun 21, 2019

@bobsmits I found that this is an issue when Text has padding in the style. Even if the padding is assigned to the top level Text, the hitbox for child Text elements seems to break.

@stale
Copy link

stale bot commented Sep 19, 2019

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 Sep 19, 2019
@caioedut
Copy link

Please pay some attention to this.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 21, 2019
@ovy9086
Copy link

ovy9086 commented Nov 1, 2019

same issue here...

@stale
Copy link

stale bot commented Jan 30, 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 Jan 30, 2020
@ilogico
Copy link

ilogico commented Feb 5, 2020

Having a similar issue. It happens both on Android and iOS.
The hit box seems to be wrongly calculated, being offset to the left.
Text aligns and monospace fonts seem to have no effect on it. The amount of text and surrounding text seems to influence the offset.
I found no workaround for it.

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

stale bot commented May 6, 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 May 6, 2020
@ilogico
Copy link

ilogico commented May 8, 2020

The issue still exists.

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

stale bot commented Aug 8, 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 Aug 8, 2020
@ilogico
Copy link

ilogico commented Aug 9, 2020

It's not fixed.

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

stale bot commented Dec 25, 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 Dec 25, 2020
@jsamr
Copy link

jsamr commented Sep 18, 2021

Stale bot, leave the issue open.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 18, 2021
@AlenToma
Copy link

I hade the same issue. The fix I found is wrapping the parent with SafeAreaView from react-native-safe-area-context and it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Platform: Android Android applications.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants