fix(js) provide default value for optional ‘assetType’
This commit is contained in:
parent
8c8c0fe921
commit
0d1059ef75
|
@ -10,6 +10,7 @@
|
|||
'use strict';
|
||||
|
||||
import RNCCameraRoll from './nativeInterface';
|
||||
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
|
||||
const GROUP_TYPES_OPTIONS = {
|
||||
|
@ -159,6 +160,9 @@ class CameraRoll {
|
|||
* See https://facebook.github.io/react-native/docs/cameraroll.html#getphotos
|
||||
*/
|
||||
static getPhotos(params: GetPhotosParams): Promise<PhotoIdentifiersPage> {
|
||||
if (!params.assetType) {
|
||||
params.assetType = ASSET_TYPE_OPTIONS.All;
|
||||
}
|
||||
if (arguments.length > 1) {
|
||||
console.warn(
|
||||
'CameraRoll.getPhotos(tag, success, error) is deprecated. Use the returned Promise instead',
|
||||
|
|
|
@ -14,6 +14,7 @@ exports[`CameraRoll Should call getPhotos 1`] = `
|
|||
Array [
|
||||
Array [
|
||||
Object {
|
||||
"assetType": "All",
|
||||
"first": 0,
|
||||
},
|
||||
],
|
||||
|
|
|
@ -29,7 +29,7 @@ export interface GetPhotosParams {
|
|||
groupName?: string,
|
||||
assetType?: AssetType
|
||||
mimeTypes?: Array<string>,
|
||||
};
|
||||
}
|
||||
|
||||
export interface PhotoIdentifier {
|
||||
node: {
|
||||
|
|
Loading…
Reference in New Issue