Default groupTypes to "All". Fixes #18

This commit is contained in:
Seph Soliman
2019-04-06 11:04:16 -07:00
parent 9540b013d3
commit cebf6f39f0
5 changed files with 12 additions and 8 deletions
+3 -3
View File
@@ -118,16 +118,16 @@ Returns a Promise with photo identifier objects from the local camera roll of th
| ------ | ------ | -------- | ------------------------------------------------ |
| params | object | Yes | Expects a params with the shape described below. |
* `first` : {number} : The number of photos wanted in reverse order of the photo application (i.e. most recent first for SavedPhotos).
* `first` : {number} : The number of photos wanted in reverse order of the photo application (i.e. most recent first for SavedPhotos). Required.
* `after` : {string} : A cursor that matches `page_info { end_cursor }` returned from a previous call to `getPhotos`.
* `groupTypes` : {string} : Specifies which group types to filter the results to. Valid values are:
* `Album`
* `All`
* `All` // default
* `Event`
* `Faces`
* `Library`
* `PhotoStream`
* `SavedPhotos` // default
* `SavedPhotos`
* `groupName` : {string} : Specifies filter on group names, like 'Recent Photos' or custom album titles.
* `assetType` : {string} : Specifies filter on asset type. Valid values are:
* `All`
+1 -1
View File
@@ -48,7 +48,7 @@ type State = {|
export default class CameraRollExample extends React.Component<Props, State> {
state = {
groupTypes: 'SavedPhotos',
groupTypes: 'All',
sliderValue: 1,
bigImages: true,
};
+1 -1
View File
@@ -90,7 +90,7 @@ type Row = {
class CameraRollView extends React.Component<Props, State> {
static defaultProps = {
groupTypes: 'SavedPhotos',
groupTypes: 'All',
batchSize: 5,
imagesPerRow: 1,
assetType: 'Photos',
+6 -3
View File
@@ -15,12 +15,12 @@ const invariant = require('fbjs/lib/invariant');
const GROUP_TYPES_OPTIONS = {
Album: 'Album',
All: 'All',
All: 'All', // default
Event: 'Event',
Faces: 'Faces',
Library: 'Library',
PhotoStream: 'PhotoStream',
SavedPhotos: 'SavedPhotos', // default
SavedPhotos: 'SavedPhotos',
};
const ASSET_TYPE_OPTIONS = {
@@ -37,7 +37,7 @@ export type GroupTypes = $Keys<typeof GROUP_TYPES_OPTIONS>;
export type GetPhotosParams = {
/**
* The number of photos wanted in reverse order of the photo application
* (i.e. most recent first for SavedPhotos).
* (i.e. most recent first).
*/
first: number,
@@ -163,6 +163,9 @@ class CameraRoll {
if (!params.assetType) {
params.assetType = ASSET_TYPE_OPTIONS.All;
}
if (!params.groupTypes) {
params.groupTypes = GROUP_TYPES_OPTIONS.All;
}
if (arguments.length > 1) {
console.warn(
'CameraRoll.getPhotos(tag, success, error) is deprecated. Use the returned Promise instead',
@@ -16,6 +16,7 @@ Array [
Object {
"assetType": "All",
"first": 0,
"groupTypes": "All",
},
],
]