react-native-image-crop-picker
react-native-image-crop-picker copied to clipboard
Not working as expected on Android 13
Version
Tell us which versions you are using:
- react-native-image-crop-picker ^0.39.0 (So the latest one)
- react-native v0.70.3
Platform
Tell us to which platform this issue is related
- Android
Expected behaviour
It should ask for my permissions and then open the files
Actual behaviour
Nothing
Steps to reproduce
1.Just add the package on a Android 13 emulator or phone
Attachments
// stacktrace or any other useful debug info
Love react-native-image-crop-picker? Please consider supporting our collective:
👉 https://opencollective.com/react-native-image-crop-picker/donate
You are likely missing the
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
in
android/app/src/main/AndroidManifest.xml
#1927
Yes the solution was: in Android 13 and up some permissions is not allowed if you don't do a popup dialog:
if (Platform.OS === 'android') { try { const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.READ_MEDIA_IMAGES, { title: 'Bestandsmachtiging', message: 'Toegang tot bestandsrechten', buttonNeutral: 'Vraag het me later', buttonNegative: 'Cancel', buttonPositive: 'OK', }); if (granted === PermissionsAndroid.RESULTS.GRANTED) { logger.info('You can acces the files'); } else { logger.info('permission denied'); } } catch (err) { logger.warning('Warning in app permissions.', err); } }
Add these permissions in
android/app/src/main/AndroidManifest.xml
if (Platform.OS === 'android') { try { const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.READ_MEDIA_IMAGES, { title: 'Bestandsmachtiging', message: 'Toegang tot bestandsrechten', buttonNeutral: 'Vraag het me later', buttonNegative: 'Cancel', buttonPositive: 'OK', }); if (granted === PermissionsAndroid.RESULTS.GRANTED) { logger.info('You can acces the files'); } else { logger.info('permission denied'); } } catch (err) { logger.warning('Warning in app permissions.', err); } }
Not Working