react-native-camera-roll-picker
react-native-camera-roll-picker copied to clipboard
Camera Roll Empty - No Photos
I already declared camera usage on info.plist:
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app does not require access to the microphone.</string>
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>
And this is in my view:
<CameraRollPicker
maximum={10}
imagesPerRow={4}
callback={this.selectImages}
selected={[]}
/>
And I still getting No photos. Any tips?
Make sure you have permissions setup correctly.
E.g. for iOS, in Info.plist
<key>NSPhotoLibraryUsageDescription</key>
<string>Tap OK to allow app to select photos from your camera roll.</string>
(tip: you may need to reset app on your Simulator to get permission dialog to show up. hit cmd+H to goto home screen of simulator, delete the app, and rebuild)
I am getting this same thing on Android. iOS works perfectly but android never asks me permission to see local photos and all I get is a spinner with no list of photos from device.
the Readme has 0 instructions for Android, is there anyone with this working that can share permissions needed and any other setup instructions?
Thanks!
I have this issue on Android, but if I enable the "Storage" permission, it works and the camera roll is populated. However the app doesn't prompt the user to ever accept this permission, so they would never know. Any update on this?
Same problem, any update?
Do we need to request the permission by ourself?
Is it better to add the feature to the library?
Eventually I do the permission request by PermissionsAndroid.
Before use the camera, check the permission by calling: await this.checkPermission();
async checkPermission(
permissions = [
PermissionsAndroid.PERMISSIONS.CAMERA,
PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE
]
) {
if (Platform.OS === 'android') {
await PermissionsAndroid.requestMultiple(permissions);
}
}
@jzhw0130, that's a great workaround to set the permissions, thanks for sharing.
The prop groupTypes="All"
(instead of SavedPhotos
) was the key for me :)
The prop
groupTypes="All"
(instead ofSavedPhotos
) was the key for me :)
It works for me!
Android 10
If you started noticing this on Android 10, try adding this to your AndroidManifest.xml
:
<application
...
android:requestLegacyExternalStorage="true" />
Android is moving to "scoped storage". They started using this in Android 10, with the option to opt-out by adding android:requestLegacyExternalStorage="true"
to your AndroidManifest.xml
file.
However, starting in Android 11, this is a forced change and your value of android:requestLegacyExternalStorage
will be ignored.
Read more here:
https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage
Posting here because that was the issue with us and it's surprisingly difficult to find out about.
Eventually I do the permission request by PermissionsAndroid.
Before use the camera, check the permission by calling: await this.checkPermission();
async checkPermission( permissions = [ PermissionsAndroid.PERMISSIONS.CAMERA, PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE ] ) { if (Platform.OS === 'android') { await PermissionsAndroid.requestMultiple(permissions); } }
It Work ! :D