'React native image picker camera crashes

I am using image picker in react native but an error occurs: file:///storage/emulated exposed beyond app through clipdata.item

On ios, the camera opens normally. and in android i can pick an image from gallery normally.

My code:

const selectFile = (itemI,inputValue) => {

     let options = {
      title: 'Select Image',
      maxWidth:800,
      maxHeight:800,
      quality:0.2,
      storageOptions: {
        skipBackup: true,
        path: 'images',
      },
       includeBase64: true,
       saveToPhotos:true
    };


   
    ImagePicker.showImagePicker(options, (response) => {
      console.log('Response = ', response);

      if (response.didCancel) {
        console.log('User cancelled image picker');
      } else if (response.error) {
        console.log('ImagePicker Error: ', response.error);
      } else if (response.customButton) {
        console.log(
          'User tapped custom button: ',
          response.customButton
        );
        alert(response.customButton);
      } else {
      //let source = response;
        // You can also display the image using data:
        let source = {
         uri: 'data:image/jpeg;base64,' + response.data
       };
        filePath[itemI]=source;
        addItemCustom(" ");
      }
    });
  };

I tried to add:

<uses-feature android:name="android.hardware.camera.any" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<uses-permission android:name="android.permission.CAMERA"/>
    <uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  <application
      ....
      android:requestLegacyExternalStorage="true"
      ...>

but the error is the same.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source