React-native-gesture-handler: RN 0.61 Release Build - 'Unhandled JS Exception: Invariant Violation: Unsupported top level event type "onGestureHandlerStateChange" dispatched

Created on 4 Oct 2019  路  22Comments  路  Source: software-mansion/react-native-gesture-handler

Hello I'm encoutering app crashes during release mode on both, iOS and Android after RN 0.60 to 0.61 upgrade.

I'm enclosing error from xCode console:

2019-10-04 08:56:06.922 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Unsupported top level event type "onGestureHandlerStateChange" dispatched
2019-10-04 08:56:06.924 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: Unsupported top level event type "onGestureHandlerStateChange" dispatched
2019-10-04 08:56:06.926353+0200 eks_golf_ng[5301:1138125] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: Invariant Violation: Unsupported top level event type "onGestureHandlerStateChange" dispatched', reason: 'Unhandled JS Exception: Invariant Violation: Unsupported top level event type "onGestureHandlerStateChange" dispatched, stack:
extractEvents@171:13016
<unknown>@171:13807
_e@171:89649
ke@171:13544
Re@171:13717
receiveEvent@171:14132
value@56:3662
<unknown>@56:764
value@56:2868
value@56:736
value@<null>:<null>
'
*** First throw call stack:
(0x197f41c30 0x197c5c0c8 0x1006f575c 0x100767644 0x197f48724 0x197e11280 0x197e11e90 0x100728190 0x10072a2a0 0x10072a004 0x100fe1e48 0x100fe32a8 0x100fea938 0x100feb528 0x100ff64e8 0x197c4eaa0 0x197c54c78)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

Does anyone encounter same issue? I will do my best to add reproducible demo ASAP.

Thank you so much for any help!

 "react-native": "0.61.2",
 "react-native-gesture-handler": "^1.4.1",
 "react-native-reanimated": "^1.3.0",
 "react-native-redash": "^8.1.2",
 "react-native-screens": "^2.0.0-alpha.3",
 "reanimated-bottom-sheet": "^1.0.0-alpha.14",

Most helpful comment

I've opened a new issue before research and I'm so sorry for that...

I added

import 'react-native-gesture-handler'

at top of index.js file as suggested in #320 and it works now 馃樃

All 22 comments

I've opened a new issue before research and I'm so sorry for that...

I added

import 'react-native-gesture-handler'

at top of index.js file as suggested in #320 and it works now 馃樃

I love those kind of magic fix, it ensures me that no one will ever take my place in the company, thank you again for that.
Please do not ever document this.

I've opened a new issue before research and I'm so sorry for that...

I added

import 'react-native-gesture-handler'

at top of index.js file as suggested in #320 and it works now 馃樃

this is working for me! thanks!!

I had the same issue , does anyone knows the reason behind this ? Pardon if its really basic thing and idk :P

@saadqadeercenseo, you tried this?
js import 'react-native-gesture-handler'
at top of index.js file as suggested in #320 and it works now

@saadqadeercenseo, you tried this?

 import 'react-native-gesture-handler'

at top of index.js file as suggested in #320 and it works now

Yup it solved my issue I'm not sure why and why the issue occur in the first place after I upgraded to RN 0.61

Also with above solutions, make sure to update to the latest version of react-native-gesture-handler: https://github.com/kmagiera/react-native-gesture-handler#react-native-support

Suggested fix doesn't work for me.

Same here, now it just crashes as soon as you open the app

For me, it crashes as soon as I touch or swipe PanGestureHandler from react-native-gesture-handler. The above solution does NOT work for me

i had to put it at the very root index.js. i wish this could get a real fix, maybe requiring an import in other libraries so that this doesnt get dropped from the code?

Same problem, I have many crash in my Firebase Crashlytics. It's difficult to reproduce on simulator.
But before RN 0.61 i hadn't this crash.
Capture d鈥檈虂cran 2019-11-18 a虁 11 27 42

Just to add to the noise in this thread...The proposed fix works for me, but it has to literally be the very first thing imported in root index.js or the crashing behaviour persists. If it wasn't clear above, make sure the import is the first line of index.js!

I already add import 'react-native-gesture-handler' in index.js at the first line. But it doesn't work.
gesture

@phyuthinkyi I think the import fixes iOS only. For Android, I found something else was necessary, detailed here, though for me I only got the crash in production, you're getting it in a simulator, so the circumstances may not be the same.

I've opened a new issue before research and I'm so sorry for that...

I added

import 'react-native-gesture-handler'

at top of index.js file as suggested in #320 and it works now 馃樃

This works perfectly, thank you!

Hello!

Added import "react-native-gesture-handler"; and solved my problem. I was having this issue only on release, and who still has the issue after add the import, try to clean the cache of the apk. I had this problem and stook on it after the add because of the cache, when I generate a clean apk, the problem was solved =)

According to this comment, this issue has been fixed by react-native-gesture-handler: 1.5.2. I can confirm that this version works for me on Android 馃槃(the import 'react-native-gesture-handler' workaround is no longer needed).

This issue has idd been addressed in a new release. No need to share workarounds. Just update to the latest version.

Hey @bitcrumb, you mean latest version of react-native-gesture-handler or react-native itself?

@Sc4ramouche Latest version of react-native-gesturehandler.
More specifically it was patched release 1.5.1.

We're still seeing this problem. RN 0.61.5 and react-native-gesture-handler 1.6.0. Our app is crashing randomly when testing. The problem even occurs when the app is in the background. Production only and low repeat frequency, it takes about 30m -1h30m to reproduce. We're using the react-native-gusture-handler for a custom bottom sheet implementation.

Was this page helpful?
0 / 5 - 0 ratings