olofd / react-native-photos-framework

A modern and comprehensive CameraRoll/iCloud-library-API for React Native 📸 📹
MIT License
220 stars 99 forks source link

Add support for olderThan parameter #62

Closed RalfNieuwenhuizen closed 7 years ago

RalfNieuwenhuizen commented 7 years ago

This parameter works the same as "after" parameter in react-native CameraRoll (https://facebook.github.io/react-native/docs/cameraroll.html)

olofd commented 7 years ago

Great PR. Will merge

CrazyPython commented 6 years ago

@RalfNieuwenhuizen Hi, I was working on a newerThan parameter, and I'm having some trouble. How is olderThan passed in from the JS side?

RalfNieuwenhuizen commented 6 years ago

@CrazyPython it's the timestamp of the previous photo, in string format. Passed in in the fetchOptions like this:

const images = await RNPhotosFramework.getAssets({
        fetchOptions: {
            olderThan,
            fetchLimit,
            mediaTypes: ["image"],
            sourceTypes: ["userLibrary", "cloudShared", "itunesSynced"],
            sortDescriptors: [
                {
                    key: "creationDate",
                    ascending: false,
                }
            ]
        },
        includeMetadata: true,
        includeResourcesMetadata: true,
    });