Merge pull request #24 from scarlac/bugfix-18-default-to-all

Default groupTypes to "All"
This commit is contained in:
Bartol Karuza 2019-04-14 10:52:57 +02:00 committed by GitHub
commit ae52098925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 8 deletions

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. | | 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`. * `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: * `groupTypes` : {string} : Specifies which group types to filter the results to. Valid values are:
* `Album` * `Album`
* `All` * `All` // default
* `Event` * `Event`
* `Faces` * `Faces`
* `Library` * `Library`
* `PhotoStream` * `PhotoStream`
* `SavedPhotos` // default * `SavedPhotos`
* `groupName` : {string} : Specifies filter on group names, like 'Recent Photos' or custom album titles. * `groupName` : {string} : Specifies filter on group names, like 'Recent Photos' or custom album titles.
* `assetType` : {string} : Specifies filter on asset type. Valid values are: * `assetType` : {string} : Specifies filter on asset type. Valid values are:
* `All` * `All`

View File

@ -48,7 +48,7 @@ type State = {|
export default class CameraRollExample extends React.Component<Props, State> { export default class CameraRollExample extends React.Component<Props, State> {
state = { state = {
groupTypes: 'SavedPhotos', groupTypes: 'All',
sliderValue: 1, sliderValue: 1,
bigImages: true, bigImages: true,
}; };

View File

@ -90,7 +90,7 @@ type Row = {
class CameraRollView extends React.Component<Props, State> { class CameraRollView extends React.Component<Props, State> {
static defaultProps = { static defaultProps = {
groupTypes: 'SavedPhotos', groupTypes: 'All',
batchSize: 5, batchSize: 5,
imagesPerRow: 1, imagesPerRow: 1,
assetType: 'Photos', assetType: 'Photos',

View File

@ -15,12 +15,12 @@ const invariant = require('fbjs/lib/invariant');
const GROUP_TYPES_OPTIONS = { const GROUP_TYPES_OPTIONS = {
Album: 'Album', Album: 'Album',
All: 'All', All: 'All', // default
Event: 'Event', Event: 'Event',
Faces: 'Faces', Faces: 'Faces',
Library: 'Library', Library: 'Library',
PhotoStream: 'PhotoStream', PhotoStream: 'PhotoStream',
SavedPhotos: 'SavedPhotos', // default SavedPhotos: 'SavedPhotos',
}; };
const ASSET_TYPE_OPTIONS = { const ASSET_TYPE_OPTIONS = {
@ -37,7 +37,7 @@ export type GroupTypes = $Keys<typeof GROUP_TYPES_OPTIONS>;
export type GetPhotosParams = { export type GetPhotosParams = {
/** /**
* The number of photos wanted in reverse order of the photo application * 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, first: number,
@ -163,6 +163,9 @@ class CameraRoll {
if (!params.assetType) { if (!params.assetType) {
params.assetType = ASSET_TYPE_OPTIONS.All; params.assetType = ASSET_TYPE_OPTIONS.All;
} }
if (!params.groupTypes) {
params.groupTypes = GROUP_TYPES_OPTIONS.All;
}
if (arguments.length > 1) { if (arguments.length > 1) {
console.warn( console.warn(
'CameraRoll.getPhotos(tag, success, error) is deprecated. Use the returned Promise instead', 'CameraRoll.getPhotos(tag, success, error) is deprecated. Use the returned Promise instead',

View File

@ -16,6 +16,7 @@ Array [
Object { Object {
"assetType": "All", "assetType": "All",
"first": 0, "first": 0,
"groupTypes": "All",
}, },
], ],
] ]