React-native: Touchable onPress not triggering after switch to RN62.0 from RN61.5

Created on 1 Apr 2020  路  11Comments  路  Source: facebook/react-native

27243 Description

Touchable components onPress functions are not triggering when after upgrade to RN62.0 from RN61.5 in debug mode in pretty much 100% of the cases. Also sometimes it happens not just in debug mode. It all happens after 3-5 seconds from application boot.
React-native-gesture-handler touchables are still working.
The problem is probably because the JS thread gets busy and can't process the onPress events. Older version of react-native had no such problem. We still use the react-native-debugger and not Flipper solution.

React Native version:

System:
OS: Linux 5.3 Ubuntu 18.04.3 LTS (Bionic Beaver)
CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Memory: 2.44 GB / 62.74 GB
Shell: 5.4.2 - /usr/bin/zsh
Binaries:
Node: 8.13.0 - ~/.nvm/versions/node/v8.13.0/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.13.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-reanimated: 1.4.0

Steps To Reproduce

The least steps we do to reproduce the error.

  1. Starting from an RN 0.62.0 code, things are frozen.
  2. If we downgrade react-native to 0.61.5 and react versions from 16.11.0 to 16.9.0 then the problem disappear.
  3. Run yarn to downgrade packages.

Expected Results

Touchable components should work the same after upgrading react-native version to 0.62.0 from 0.61.5. Also the JS thread should not be frozen.

Snack, code example, screenshot, or link to a repository:

We expect the same things happen on example react-native code.

Attention Repro Duplicate

Most helpful comment

All 11 comments

Is this in debug mode?

:warning: Missing Reproducible Example
:information_source: It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.

Is this in debug mode?

Yes, in debug mode it is reproducible with high chances.

Is this in debug mode?

Yes, in debug mode it is reproducible with high chances.

Yeah same thing for me. I tried on old upgraded project and created a new clean one. In both cases it looks like debugger silently lost connection, thats why its not working ( I think). Without debug it works ok.

Env:

System:
OS: macOS Mojave 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 257.77 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.13.0 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 17, 23, 25, 26, 27, 28
Build Tools: 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.0, 28.0.0, 28.0.1, 28.0.2, 28.0.3
System Images: android-17 | ARM EABI v7a, android-17 | MIPS, android-17 | Intel x86 Atom, android-17 | Google APIs ARM EABI v7a, android-17 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-25 | China version of Android Wear ARM EABI v7a, android-25 | China version of Android Wear Intel x86 Atom, android-25 | Android Wear ARM EABI v7a, android-25 | Android Wear Intel x86 Atom, android-25 | Intel x86 Atom, android-25 | Intel x86 Atom_64, android-25 | Google APIs ARM 64 v8a, android-25 | Google APIs ARM EABI v7a, android-25 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64, android-25 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 11.3/11C29 - /usr/bin/xcodebuild
Languages:
Python: 2.7.15 - /usr/local/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.0 => 0.62.0
npmGlobalPackages:
react-native: Not Found

I am seeing same error logged multiple time in LogCat during app start:

2020-04-02 00:12:15.801 17598-17854/com.myapp E/unknown:ReactContextBaseJavaModule: Unhandled SoftException java.lang.RuntimeException: Catalyst Instance has already disappeared: requested by WebSocketModule at com.facebook.react.bridge.ReactContextBaseJavaModule.getReactApplicationContextIfActiveOrWarn(ReactContextBaseJavaModule.java:67) at com.facebook.react.modules.websocket.WebSocketModule.sendEvent(WebSocketModule.java:62) at com.facebook.react.modules.websocket.WebSocketModule.access$100(WebSocketModule.java:40) at com.facebook.react.modules.websocket.WebSocketModule$1.onMessage(WebSocketModule.java:187) at okhttp3.internal.ws.RealWebSocket.onReadMessage(RealWebSocket.java:322) at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.java:219) at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:105) at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:273) at okhttp3.internal.ws.RealWebSocket$1.onResponse(RealWebSocket.java:209) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:174) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764)

Same here for me. Touchable doesn't with remote debugging turned on.

In noticed that it's not triggered (in my case) when you do a longPress.
I'm on iOS simulator

i have same error with debug enable in iOS device

Note: I use react-native-gesture-handler and working properly

This is an interesting issue, maybe it has connections to the react-native-gesture-handler library? I also use that. Also I only tested this issue on Android, I don't know if this is the same on iOS.

Same issue but I don't have the same message in logcat as @inpendio

No real error messages for us, just no action from the touchables.

Hi @Sixzero than you for the issue!

This fixed the issue for me:
#27008 (comment)

Did this help solve your issue?

I'll close this issue as a dup of the issue filed above ^

Was this page helpful?
0 / 5 - 0 ratings