This repo aim to provide explanation, discussion and cross-project workaround ideas for the React Native issue #30277.
Bug:
Android ReactActivity destroy prevents successful onActivityResult calls for any native android module. This is the case when opening the camera using the android.media.action.IMAGE_CAPTURE
intent, and in some case even the file picker.
Details about this can be found on the issue by zsweigart on RN repo #30277.
Context: specific devices with vendor android clunky versions
Devices with reproduction
- Xiaomi Redmi 7A with MIUI 12.0.1 (not older version), verified ✅
- Xiaomi Redmi 8A with MIUI 12.0.1, verified ❎
- Xiaomi Mi 9 SE with MIUI 12.0.3
- Add a pull request if you can reproduce this on other devices
Device where the fix does not work
- Huawei Psmart 2019, android 10
Available workaround:
react-native-image-crop-picker
, limited to single image, see here
You can use the Android project from this repo to dig into the issue and submit a patch for your own module.
During one month, Pl@ntNet android app recovered 330k images using this method which represent ~1% of image picked within the app.
react-native-image-crop-picker
- ivpusic/react-native-image-crop-picker#955
- ivpusic/react-native-image-crop-picker#1195
- ivpusic/react-native-image-crop-picker#240
- ivpusic/react-native-image-crop-picker#1519
- and many more
react-native-image-picker
expo-image-picker