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
5.85k stars 954 forks source link

[Bug]: RNGestureHandlerModule.attachGestureHandler got 2 arguments, expected 3 #1771

Closed myckhel closed 1 year ago

myckhel commented 2 years ago

Description

After upgrading to v^2 from v1, release apk crashes with error

com.facebook.react.bridge.NativeArgumentsParseException: RNGestureHandlerModule.attachGestureHandler got 2 arguments, expected 3
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:30)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:13)
    at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:1)
    at android.os.Looper.loop(Looper.java:214)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:8)
    at java.lang.Thread.run(Thread.java:919)

Screenshots

Steps To Reproduce

  1. Upgrade rngh from v^1 to v2.1.0

Package versions

itsramiel commented 2 years ago

same error

mrdezzods commented 2 years ago

I have the same issue

Douglas-Hsieh commented 2 years ago

Same issue here when upgrading react-native-gesture-handler and expo with $ expo upgrade

react-native-gesture-handler 2.1.0 expo 44.0.0 react native 0.64.3 react 17.0.1

Also wrapped my app in a <GestureHandlerRootView> component per gesture-handler installation instructions

waheedakhtar694 commented 2 years ago

Same here.


    com.facebook.react.bridge.NativeArgumentsParseException: RNGestureHandlerModule.attachGestureHandler got 2 arguments, expected 3
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:349)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
        at android.os.Looper.loop(Looper.java:236)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:923)
2022-01-25 15:17:08.506 32713-32713/com.create.wefiq E/unknown:ReactContextBaseJavaModule: Unhandled SoftException
    java.lang.RuntimeException: Catalyst Instance has already disappeared: requested by Timing
        at com.facebook.react.bridge.ReactContextBaseJavaModule.getReactApplicationContextIfActiveOrWarn(ReactContextBaseJavaModule.java:66)
        at com.facebook.react.modules.core.TimingModule.access$000(TimingModule.java:22)
        at com.facebook.react.modules.core.TimingModule$BridgeTimerExecutor.callTimers(TimingModule.java:28)
        at com.facebook.react.modules.core.JavaTimerManager$TimerFrameCallback.doFrame(JavaTimerManager.java:84)
        at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
        at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1056)
        at android.view.Choreographer.doCallbacks(Choreographer.java:880)
        at android.view.Choreographer.doFrame(Choreographer.java:809)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1043)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:236)
        at android.app.ActivityThread.main(ActivityThread.java:7861)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)```
bozkayasalihx commented 2 years ago

I have same issue please fix this issue

alexprey commented 2 years ago

Have the same, subscribe to wait a fix. That commes only when I try to upgrage on 2.x

bozkayasalihx commented 2 years ago

okay, how can I subscribe waitlist?

felipegmg commented 2 years ago

+1 with this issue

LotfiOR commented 2 years ago

Same issue here :/ please help

ewlkkf commented 2 years ago

+1 issue happens to me. but when I rollback android build tools and gradle version, It's working right now.

'com.android.tools.build:gradle:7.0.4' gradle-7.0.2-all.zip

mhuretski commented 2 years ago

Same issue for me react-native: 0.67.2 react-native-gesture-handler: 2.2.0 react-native-reanimated: 2.4.1

It doesn't reproduce on Android emulator but reproduces on real device.

fangwohung commented 2 years ago

Same issue for me, pls fix this

jakub-gonet commented 2 years ago

This is likely related to a stale cache. Try clearing the cache in Metro - yarn start --reset-cache. If that doesn't help, try removing node_modules and reinstalling.

If that doesn't help, please reply below.

waheed25 commented 2 years ago

@jakub-gonet restarting the metro didn't works for me.

nmante commented 2 years ago

This is still an issue unfortunately. When using version 2.1.1, I get this error. Rolling back to version 1.10.3 fixes the issue for me.

cgarcial-mx commented 2 years ago

I tried everything on this thread and the issue is still there.

I'm working with Expo SDK 44 , react 17.0.1 and Expo CLI 5.3.0

j-piasecki commented 2 years ago

Hi! You can try the following steps:

Sk47R commented 2 years ago
rm -rf node_modules
yarn cache clean / npm cache clean -force 
yarn / npm install
expo r -c

I did the steps above. But by app crashes. If i comment the chart component, it works. I'm still finding for a fix.

j-piasecki commented 2 years ago

What do you mean by

If i comment the chart component, it works

@Sk47R ?

Sk47R commented 2 years ago

I mean I have issue with the chart. Same as others. And none of the solutions worked

Sk47R commented 2 years ago

I found somewhere that this problem is only in android and in ios it works. For now ive used another library. But i would like to know the reason and solution

j-piasecki commented 2 years ago

Is this your own component or is it from some library? I asked because no one else mentioned it and it could be a lead.

Sk47R commented 2 years ago

Its my custom component.

bryce0516 commented 2 years ago

same issue in expo "expo": "~44.0.0", "react-native-gesture-handler": "~1.10.2", "react-native-reanimated": "~2.2.0",

I try react-native-gesture-handler 2.1, 2.3, but also faced error

below version in expo 42.0.0 is working "react-native-gesture-handler": "~1.10.2", "react-native-reanimated": "~2.2.0",

I faced issue when i migrate to typescript and expo 44 sorry for poor english.

bryce0516 commented 2 years ago

I solved this problem. I try 'expo install react-native-gesture-handler react-native-reanimated' , and wrapped root view with GestureHandlerRootView

ahe99 commented 2 years ago

same here platform ios

still finding :'(

j-piasecki commented 2 years ago

If you are using managed workflow, make sure you are using the correct version of Gesture Handler - 1.10 for SDK 43, 2.1 for SDK 44 and 2.2 for SDK 45.

amitvish09 commented 1 year ago

is this fixed? or Not?

j-piasecki commented 1 year ago

@amitvish09 This is most likely caused by mismatched versions of Expo and Gesture Handler, please use expo install react-native-gesture-handler to install the correct version of GH.

Vednus commented 1 year ago

Weirdly, this is happening to me only on release builds on android with expo 45 and rn 68.2. I've reset the cache, deleted node_modules, reinstalled using expo install react-native-gesture-handler, and looked through my yarn.lock for old version dependencies to no avail.

Vednus commented 1 year ago

Finally got it fixed. The last thing I did was downgrade gradle following this comment and also using this gradle script to even out the kotlin versions. Not sure which one it was that did the trick.

mickykro commented 11 months ago

Hi! You can try the following steps:

  • Expo:
rm -rf node_modules
yarn cache clean / npm cache clean -force 
yarn / npm install
expo r -c
  • Otherwise:
rm -rf node_modules
yarn cache clean / npm cache clean -force 
yarn / npm install
npm start -- --reset-cache

this didnt help me, I have the same issue on IOS and it shows the error only on a device and on emulator it works perfectly. please do anyone have a different answer ?