react-native-image-picker / react-native-image-picker

:sunrise_over_mountains: A React Native module that allows you to use native UI to select media from the device library or directly from the camera.
MIT License
8.47k stars 2.08k forks source link

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

Open dipendra-sharma opened 2 years ago

dipendra-sharma commented 2 years ago

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

Solution

Additional Information

me294 commented 2 years ago

same issue !

Johan-dutoit commented 2 years ago

Can you replicate it with the example app?

dipendra-sharma commented 2 years ago

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

Mervsz commented 2 years ago

facing same issue. crashing after selecting an image

dipendra-sharma commented 2 years ago

Any update on this issue?

JJSLIoT commented 2 years ago

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

cadu1 commented 2 years ago

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:

...
  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

yorickshan commented 2 years ago

any updates?

QuentG commented 1 year ago

any updates ?

Fardeen-N commented 5 months ago

Can anyone of you able to figure out what's causing this or do we have to use alternative library any suggestion?