/react-native-issue-30277

Investigation and potential workaround for https://github.com/facebook/react-native/issues/30277

Primary LanguageJavaMIT LicenseMIT

React Native issue #30277

This repo aim to provide explanation, discussion and cross-project workaround ideas for the React Native issue #30277.

Issue

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

Workaround

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.

Results

During one month, Pl@ntNet android app recovered 330k images using this method which represent ~1% of image picked within the app.

Related issues

react-native-image-crop-picker

react-native-image-picker

expo-image-picker