react-native-camera-roll-picker icon indicating copy to clipboard operation
react-native-camera-roll-picker copied to clipboard

Camera Roll Empty - No Photos

Open luco opened this issue 8 years ago • 10 comments

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?

luco avatar Feb 06 '17 01:02 luco

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)

twairball avatar Jun 01 '17 16:06 twairball

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!

n8stowell82 avatar Jan 28 '18 06:01 n8stowell82

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?

f6m6 avatar May 24 '18 15:05 f6m6

Same problem, any update? Do we need to request the permission by ourself?
Is it better to add the feature to the library?

jzhw0130 avatar Aug 02 '18 14:08 jzhw0130

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 avatar Aug 08 '18 02:08 jzhw0130

@jzhw0130, that's a great workaround to set the permissions, thanks for sharing.

asalem1 avatar Sep 14 '18 15:09 asalem1

The prop groupTypes="All" (instead of SavedPhotos) was the key for me :)

MaxInMoon avatar Jun 21 '19 13:06 MaxInMoon

The prop groupTypes="All" (instead of SavedPhotos) was the key for me :)

It works for me!

olkunmustafa avatar Nov 25 '19 11:11 olkunmustafa

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.

joshuapinter avatar Dec 23 '20 22:12 joshuapinter

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

zoom2009 avatar Jan 19 '21 17:01 zoom2009