question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
ilogicocommented, Aug 9, 2020

It’s not fixed.

3reactions
kevinaverycommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

html - Enlarging a Specific Area of Clickable Nested Text
You can wrap the text you want to be pressable into a Pressable component and then increase the tappable area by using the...
Read more >
Unreal Engine 4.11 Release Notes
This release brings hundreds of updates for Unreal Engine 4, including 92 improvements submitted by the community of Unreal Engine developers on GitHub!...
Read more >
@material-ui/core | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
React native modal bottom sheet examples pdf download ...
page not showing react on window resize react onblur react onChange react functional programming onchange text input react native onclick ...
Read more >
Diff - platform/packages/inputmethods/LatinIME
This onPress call may have changed keyboard layout. ... hitBoxWidth = hitBox.width(); final int hitBoxHeight = hitBox.height(); final float hitBoxDiagonal ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found