react-native-image-picker icon indicating copy to clipboard operation
react-native-image-picker copied to clipboard

[🐛] Illegal callback invocation from native module. This callback type only permits a single invocation from native code.

Open dipendra-sharma opened this issue 3 years ago • 10 comments
trafficstars

Description

Application Crash while picking Image. Caused by java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code. at com.facebook.react.bridge.CallbackImpl.invoke(CallbackImpl.java:26) at com.imagepicker.ImagePickerModule.onActivityResult(ImagePickerModule.java:184) at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:305) at com.facebook.react.ReactInstanceManager.onActivityResult(ReactInstanceManager.java:762) at com.facebook.react.ReactDelegate.onActivityResult(ReactDelegate.java:90) at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:112) at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:68) at money.jupiter.MainActivity.onActivityResult(MainActivity.kt:47) at android.app.Activity.dispatchActivityResult(Activity.java:8113) at android.app.ActivityThread.deliverResults(ActivityThread.java:5037) at android.app.ActivityThread.handleSendResult(ActivityThread.java:5085) at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:140) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2080) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:264) at android.app.ActivityThread.main(ActivityThread.java:7581) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)

How to repeat issue and example

  • Not reproducible every-time. Seems Random crash being received.

Solution

Additional Information

  • Image Picker version: ^4.0.4
  • React Native version: ^0.64.1
  • Platform: Android
  • Development Operating System: Mac OS
  • Dev tools: Android Studio

dipendra-sharma avatar Feb 08 '22 09:02 dipendra-sharma

same issue !

me294 avatar Feb 09 '22 04:02 me294

Can you replicate it with the example app?

Johan-dutoit avatar Feb 09 '22 09:02 Johan-dutoit

I'm not facing this issue always. Getting it on Crashlytics.

dipendra-sharma avatar Feb 10 '22 07:02 dipendra-sharma

facing same issue. crashing after selecting an image

Mervsz avatar Mar 07 '22 04:03 Mervsz

Any update on this issue?

dipendra-sharma avatar Mar 09 '22 08:03 dipendra-sharma

Possible duplicate of https://github.com/react-native-image-picker/react-native-image-picker/issues/713

JJSLIoT avatar Mar 09 '22 09:03 JJSLIoT

It's happening with me when I tap multiple times on the button and I don't have the default gallery app defined! I've tried to apply a solution that I found in another issue but with no success (using ref).

to replay:

  • multiple taps on the button that calls the function
  • after appearing "Choose an action", cancel all of them (tapping out side the box)
  • the app will crash
...
  const handleSelectProfilePicture = () => {
    if (isPickerOpen.current) return;
    isPickerOpen.current = true;

    try {
      const imageResult = launchImageLibrary({ mediaType: 'photo' }, () => {
        isPickerOpen.current = false;
      });
    ...
  }
...
<TouchableOpacity
  activeOpacity={1.0}
  onPress={handleSelectProfilePicture}
>
...

image

cadu1 avatar Mar 28 '22 19:03 cadu1

any updates?

yorickshan avatar Apr 01 '22 06:04 yorickshan

any updates ?

QuentG avatar Apr 14 '23 08:04 QuentG