Skip to content

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

@bobsmits

Description

@bobsmits

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>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions