Skip to content

CameraRoll.getPhotos not returning iCloud photos #21836

@marioharper

Description

@marioharper

Environment

Environment:
  OS: macOS High Sierra 10.13.5
  Node: 8.12.0
  Yarn: 1.7.0
  npm: 6.4.1
  Watchman: 4.9.0
  Xcode: Xcode 9.4.1 Build version 9F2000
  Android Studio: 3.1 AI-173.4720617

Packages: (wanted => installed)
  react: 16.3.1 => 16.3.1
  react-native: https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz => 0.55.4

Description

Related #1579, #17532.

Currently RN is using ALAsset which is deprecated from iOS 8. RN should use the Photos framework instead, which in iOS 8.0 and later provides more features and better performance for working with a user’s photo library. I am currently experiencing issues with retrieving iCloud photos from CameraRoll.

Photos App - All Photos

simulator screen shot - iphone 6 - 2018-10-17 at 15 46 53

CameraRoll.getPhotos

simulator screen shot - iphone 6 - 2018-10-17 at 15 47 12

Reproducible Demo

Have iCloud integrated and "Optimize iPhone Storage" enabled. Then in your emulator Trigger iCloud Sync via the Debug menu. Then run the snippet below. You would expect to see all of your images you can view in the iPhone Photos app under All Photos rendered, however, it only shows some of your images.

import React from 'react';
import { Image, CameraRoll, FlatList } from 'react-native';

export default class CameraRollTest extends React.Component {
  state = {
    photos: []
  };

  componentDidMount = async () => {
    const result = await CameraRoll.getPhotos({
      first: 1000,
      groupTypes: 'All'
    });

    this.setState({
      photos: result.edges
    });
  };

  render() {
    return (
      <FlatList
        numColumns={3}
        data={this.state.photos}
        keyExtractor={item => item.node.image.uri}
        renderItem={({ item }) => (
          <Image
            style={{ width: 100, height: 100 }}
            source={{
              uri: item.node.image.uri
            }}
          />
        )}
      />
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions