Unsupported top level event type "onGestureHandlerStateChange dispatched in iphone X
Asked Answered
C

3

8

I am facing an issue in react-navigation-drawer.

"react-native-gesture-handler": "^1.0.16",
"react-navigation": "^3.3.2"

This two version is installed. A drawer is working properly in Android and iPhone 5S. But, when I ran the app in iPhone X, it's throw error when I open drawer through gesture.

Unsupported top level event type "onGestureHandlerStateChange" dispatched

Consociate answered 28/2, 2019 at 10:37 Comment(0)
H
31

From this react-native-gesture-handler issue comment by balthazar:

Because my navigators were created asynchronously, the handler was registered too late and thus throwing this error. I fixed the issue by simply doing:

import 'react-native-gesture-handler';

at the top of my index.js πŸ™‚

By index.js, balthazar is referring to your app's entrypoint – but I guess that the important thing is that it is imported before your first usage of react-native-gesture-handler.

Heptahedron answered 24/7, 2019 at 12:22 Comment(1)
you saved my live :) – Maziemazlack
W
9

If your RN version is above 0.60+

In my case, you should firstly add import 'react-native-gesture-handler'; in your top index.js file.

Then upgrade your react-native-gesture-handler to version >= 1.5.1 because the maintainer fixed a crash problem in IOS and you can see the closed issue here issue#320

Woodall answered 15/9, 2020 at 10:21 Comment(2)
This was it! Thanks! – Somniferous
That's awesome. – Tambourine
S
2

Downgrade to v1.0.14 fixes the issue for me

Sulph answered 6/3, 2019 at 6:9 Comment(3)
Thanks! This fixed it for me on RN 59! – Kermes
But it doesn't fix the issue for RN versions > 0.60 – Chobot
@HarshitAgrawal For RN0.60 >, need to use the import fix as commented by Jamie – Sulph

© 2022 - 2024 β€” McMap. All rights reserved.