React-native: Long press broken for TouchableNativeFeedback

Created on 18 Mar 2019  路  24Comments  路  Source: facebook/react-native

馃悰 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
Bug TouchableNativeFeedback Regression Linux Locked

Most helpful comment

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

All 24 comments

Hey @mjmasn thanks for filing, I looked into this and the long press appears to be working in your repo:

repro

If you can clarify how to repro I'm happy to look again and re-open 馃憣

@rickhanlonii hmm, it's broken on a variety of real devices in our office. Could be a specific Android version maybe? I haven't tried any emulators yet but will do so this afternoon. The issue does appear to be intermittent, sometimes after a few attempts it does trigger the onLongPress handler but it's probably 1 in 10 attempts or fewer.

I'm running Android 9 on a Samsung Galaxy S9+

Ok cool, lmk if you can find a simulator to repro in 馃憤

Working on emulators:
Nexus_5X_API_25
Nexus_6P_API_26
Pixel_C_API_27
Pixel_2_XL_API_28

Working on real devices:
LGE Nexus 5 running Android 6.0.1 (API 23)
Huawei P8 lite 2017 running Android 7.0 (API 24)
LGE Nexus 5X running Android 8.1.0 (API 27)

Broken on real devices:
Samsung Galaxy A5 (2016) running Android 7.0 (API 24)
Samsung Galaxy S9+ running Android 9 (API 28)

Possibly a Samsung theme here but I don't have any other devices to hand. Would be helpful if other Samsung users could chime in...

Hey @mjmasn, thanks for more testing!

Re-opening so we can test on those devices and figure out what's happening

Thanks @rickhanlonii :+1:

One final piece of information: the issue is also affecting <TouchableHighlight /> in the same way.

<TouchableOpacity /> and <TouchableWithoutFeedback /> are not affected.

@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 :upside_down_face:

also affecting TouchableHighlight on iOS

Yeah I'm having this issue on both iOS and android with TouchableHighlight.
Was working on 0.58.x
Issue after upgrading to both 0.59.0 and 0.59.1
iPhone X, iOS 12.2
Samsung Galaxy S8, android 8.0.0

i have this problem in TouchableHighlight as mentioned above @rickhanlonii , its a big mistake that i upgrade my project and see this ridiculous bug, fix it as soon as possible

I'm having this issue too on iOS and Android! RN 0.59.1

iOS 12.1.4, iPhone X and Android 9.0, Pixel 3

RN 0.59.2 ,This bug still exists

@rickhanlonii hmm actually it looks like your commit here might have triggered this: 3bef4bd#diff-580446e098bcae0cd35585b8cf689f2aL501

Apparently that line was not just a perf optimisation 馃檭

FYI. Just forked a private repo to revert this commit. It is confirmed that commit causes the issue.

was able to reproduce it on OnePlus 5t.

@rickhanlonii is a fix for this set for an upcoming release?

Same here, OnePlus 6. #24238 solved the issue for me as well.

yes this is fixed in [email protected]

Just upgraded to 0.59.4, I'm still not getting the trigger for Pixel 2 on Android 9

Confirmed broken on 0.59.10 on a Pixel 3 XL using TouchableOpacity

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

@danielidt this particular bug was fixed and the issue has been closed for a while. It sounds like you're experiencing a different problem so I'd recommend opening a new issue in this repo. I doubt you'll get any replies on this one.

I wanted to report to whoever is seeing this on Android 10, I tried on Nokia 6.1 with react-native: 0.59.1 the onLongPress was triggering right away (even with a delay) -- but that was the case _only_ when remote-debugging as @danielidt mentioned above.

Turning off the remote debugging worked fine without having to update the react-native packager. I left it at 0.59.1, and all works as expected.

Was this page helpful?
0 / 5 - 0 ratings