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.

Long press broken for TouchableNativeFeedback

See original GitHub issue

🐛 Bug Report

After upgrading from React Native 0.58.6 to 0.59.1, any <TouchableNativeFeedback /> with onLongPress is no longer working i.e. the handler is never fired.

To Reproduce

Use TouchableNativeFeedback with onLongPress in a React Native 0.59.1 app.

Expected Behavior

Long pressing the TouchableNativeFeedback triggers the onLongPress handler

Code Example

https://github.com/mjmasn/rn59_tnf_longpress

Environment

info 
  React Native Environment Info:
    System:
      OS: Linux 4.15 Ubuntu 16.04.6 LTS (Xenial Xerus)
      CPU: (8) x64 Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
      Memory: 856.03 MB / 15.54 GB
      Shell: 4.3.48 - /bin/bash
    Binaries:
      Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
      Yarn: 1.15.2 - /usr/bin/yarn
      npm: 5.6.0 - ~/.nvm/versions/node/v8.11.3/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      Android SDK:
        API Levels: 16, 19, 22, 23, 26, 27, 28
        Build Tools: 23.0.1, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.3, 28.0.2, 28.0.3
        System Images: android-16 | Google APIs Intel x86 Atom, android-17 | Google APIs Intel x86 Atom, android-18 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-24 | Google APIs Intel x86 Atom, android-25 | Google Play Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64
    IDEs:
      Android Studio: 3.1 AI-173.4907809
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.1 => 0.59.1 
    npmGlobalPackages:
      create-react-native-app: 2.0.2
      react-native-cli: 2.0.1
      react-native-create-library: 3.1.2
      react-native-git-upgrade: 0.2.7

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:24 (13 by maintainers)

github_iconTop GitHub Comments

6reactions
danielidtcommented, Jul 31, 2019

Wanted to update, the issue on 0.59.10 only seemed to happen when remote-debugging was turned on, onPress would trigger onLongPress instead

However, after upgrading to RN 0.60.0, onLongPress on touchableOpacity is not working at all when using remote debugger.

works fine when not debugging

6reactions
mjmasncommented, Mar 19, 2019

@rickhanlonii hmm actually it looks like your commit here might have triggered this: https://github.com/facebook/react-native/commit/3bef4bddbfbdaaa7f431bbada5d72c26e01a45d6#diff-580446e098bcae0cd35585b8cf689f2aL501

Apparently that line was not just a perf optimisation 🙃

Read more comments on GitHub >

github_iconTop Results From Across the Web

TouchableNativeFeedback onLongPress radius not affected
When I perform a longPress, then the borderRadius fix does not have any affect. Border radius during long press.
Read more >
Handling Touches - React Native
These long presses can be handled by passing a function to the onLongPress props of any of the "Touchable" components.
Read more >
Stack Overflow: Active questions tagged ...
I have a long text (for example, part of some book), and I need to render it on the screen but I need...
Read more >
Example of onLongPress on TouchableOpacity in React Native
This is a very common thing that we experience in our daily use like we use to get edit or delete option on...
Read more >
Pressable vs. Touchable in React Native | by MahYar - Medium
A core component that detects different steps of press ... onLongPress: Called if the time after onPressIn lasts longer than 500 ...
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