software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.12k stars 980 forks source link

How should i resolve this? #1149

Closed kamalpandey closed 4 years ago

kamalpandey commented 4 years ago
java.lang.RuntimeException: 
  at com.facebook.react.bridge.ReactContext.handleException (ReactContext.java:344)
  at com.facebook.react.bridge.ReactContext$ExceptionHandlerWrapper.handleException (ReactContext.java:351)
  at com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:31)
  at android.os.Handler.handleCallback (Handler.java:883)
  at android.os.Handler.dispatchMessage (Handler.java:100)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:7811)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1076)
Caused by: java.lang.NullPointerException: 
  at versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootHelper.<init> (RNGestureHandlerRootHelper.java:48)
  at versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerEnabledRootView.initialize (RNGestureHandlerEnabledRootView.java:54)
  at versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerModule$2.execute (RNGestureHandlerModule.java:603)
  at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute (UIViewOperationQueue.java:498)
  at com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:779)
  at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:888)
  at com.facebook.react.uimanager.UIViewOperationQueue.access$2200 (UIViewOperationQueue.java:42)
  at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded (UIViewOperationQueue.java:846)
  at com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:29)
  at android.os.Handler.handleCallback (Handler.java:883)
  at android.os.Handler.dispatchMessage (Handler.java:100)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:7811)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1076)
jakub-gonet commented 4 years ago

Please provide more info, namely library versions, and repro if possible. Closing until then.

This particular error often springs up when the React context is null which happens when you have two instances of ReactInstanceManager running simultaneously. Check for thread-safety issues.

kamalpandey commented 4 years ago
"dependencies": {
    "@react-native-community/masked-view": "^0.1.5",
    "@react-native-community/netinfo": "^4.6.0",
    "@react-native-community/viewpager": "^2.0.2",
    "axios": "^0.19.2",
    "decode-html": "^2.0.0",
    "expo": "^36.0.0",
    "expo-analytics-segment": "~8.0.0",
    "expo-apple-authentication": "~2.0.0",
    "expo-asset": "~8.0.0",
    "expo-calendar": "~8.0.0",
    "expo-constants": "~8.0.0",
    "expo-font": "~8.0.0",
    "expo-google-app-auth": "^7.0.0",
    "expo-google-sign-in": "~8.0.0",
    "expo-image-picker": "~8.0.1",
    "expo-permissions": " ~8.0.0",
    "expo-web-browser": "~8.0.0",
    "json-api-normalizer": "^1.0.0",
    "lodash": "^4.17.10",
    "moment": "^2.27.0",
    "pusher-js": "^6.0.3",
    "raygun4js": "2.16.1",
    "react": "16.8.3",
    "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
    "react-native-autocomplete-input": "^4.2.0",
    "react-native-collapsible": "^1.5.2",
    "react-native-confirmation-code-field": "^6.5.0",
    "react-native-country-picker-modal": "^0.8.0",
    "react-native-device-detection": "^0.2.0",
    "react-native-dropdownalert": "^4.3.0",
    "react-native-elements": "^1.1.0",
    "react-native-gesture-handler": "~1.5.0",
    "react-native-gifted-chat": "^0.16.3",
    "react-native-htmlview": "https://github.com/maharjanaman/react-native-htmlview",
    "react-native-image-progress": "^1.1.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-loading-spinner-overlay": "^1.0.1",
    "react-native-mentions": "https://github.com/kamalpandey/react-native-mentions",
    "react-native-modal": "^11.5.6",
    "react-native-phone-input": "^0.2.4",
    "react-native-popup-menu": "^0.15.9",
    "react-native-progress": "^4.1.2",
    "react-native-read-more-text": "^1.1.2",
    "react-native-reanimated": "~1.4.0",
    "react-native-render-html": "https://github.com/kamalpandey/react-native-render-html",
    "react-native-safe-area-context": "^0.6.0",
    "react-native-safe-area-view": "^1.1.1",
    "react-native-screens": "2.0.0-alpha.12",
    "react-native-segmented-control-tab": "^3.4.1",
    "react-native-select-list2": "^1.0.8",
    "react-native-tab-view": "2.15.0",
    "react-native-tab-view-viewpager-adapter": "^1.1.0",
    "react-native-tag-input": "https://github.com/maharjanaman/react-native-tag-input",
    "react-native-webview": "^7.0.5",
    "react-navigation": "^4.0.9",
    "react-navigation-stack": "^2.8.2",
    "react-navigation-tabs": "^2.9.0",
    "react-redux": "^7.0.0",
    "redux": "^4.0.5",
    "redux-form": "^8.3.6",
    "redux-object": "^0.5.10",
    "redux-persist": "^5.10.0",
    "redux-promise-middleware": "^6.1.1",
    "redux-thunk": "^2.3.0",
    "rn-placeholder": "^3.0.0",
    "sentry-expo": "~2.1.1",
    "styled-components": "^5.1.1",
    "uuid": "^3.2.1"
  },
kamalpandey commented 4 years ago

@jakub-gonet If this helps I am quite not sure from which portion of the code i am receiving this in the production.

jakub-gonet commented 4 years ago

It doesn't really help, but check your RN android config and make sure that context can't be null at any time when creating a new instance of RNGestureHandlerRootHelper.

Vetsch0r commented 3 years ago

I found exactly the same error in our bug reports of the play store as well. We use the version 1.7.0, but i can't really say when and how the problem happens.

@kamalpandey: Could you already resolve the issue on your side?

jakub-gonet commented 3 years ago

@Vetsch0r do you have a hybrid app (RN + native components using React Context)? This shouldn't happen if you integrated an RN app with RNGH only.

Vetsch0r commented 3 years ago

Nope we use it together with Expo and Redux.

jakub-gonet commented 3 years ago

Strange. If you have consistent way of triggering this error (with some small repro example) please open a new issue.

Does it still happen with newest expo and RN? We fixed some concurrency errors in 1.8 although they may be unrelated to this issue.

Only three first lines in stacktrace are relevant to the crash which is a bit too small to guess what happened, we need to dynamically analize flow of the program to fix that.

Vetsch0r commented 3 years ago

Yes i was checking some other things and found this by coincidence. But i will do some additional checks and can hopefully provide you with more information.

We currently use expo 39.0.0 it may be linked somehow to this version.

kamalpandey commented 3 years ago

@Vetsch0r No it is still occuring but the expo version I am using is 38.