When using ImagePicker to launch the camera and return a cropped image, I am seeing a problem when testing the MainActivity recreation described in the docs. When returning from the camera to the image cropper view (when Don't keep activities
is checked), the app crashes upon resume with this error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{io.hedira.care.dev/io.hedira.care.MainActivity}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.ScreenStackFragment: could not find Fragment constructor
There is a workaround for the cause of that stacktrace, however, applying that means that the app goes back to the main screen, rather than the image cropper.
I’ve been unable to find any examples in the wild of getPendingResultAsync()
being used, and I am unsure if there are further changes I need to make to my app to allow it to resume correctly.
- Has anyone successfully used
getPendingResultAsync()
in conjunction with cropping and/or recent versions ofreact-navigation
(which relies onreact-native-screens
)? - How important/likely is it that this is required? I’ve not used ImagePicker in production apps before, so I am not sure if this is required even.
For reference, here’s how my app is launching the camera picker:
const imageData = await ImagePicker.launchCameraAsync({
allowsEditing: true,
aspect: [1, 1],
quality: 0.9,
});
SDK Version: 39, Platform: Android, Bare workflow