From 0d1059ef75889103382c26e2cc18b32c393943e0 Mon Sep 17 00:00:00 2001 From: Bartol Karuza Date: Sun, 3 Mar 2019 20:46:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(js)=20provide=20default=20value=20for=20opt?= =?UTF-8?q?ional=20=E2=80=98assetType=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/CameraRoll.js | 4 ++++ js/__tests__/__snapshots__/CameraRollTest.js.snap | 1 + typings/CameraRoll.d.ts | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/js/CameraRoll.js b/js/CameraRoll.js index 9f5c8ea12..29f67d649 100644 --- a/js/CameraRoll.js +++ b/js/CameraRoll.js @@ -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 { + 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', diff --git a/js/__tests__/__snapshots__/CameraRollTest.js.snap b/js/__tests__/__snapshots__/CameraRollTest.js.snap index c2840613f..c4f30ee99 100644 --- a/js/__tests__/__snapshots__/CameraRollTest.js.snap +++ b/js/__tests__/__snapshots__/CameraRollTest.js.snap @@ -14,6 +14,7 @@ exports[`CameraRoll Should call getPhotos 1`] = ` Array [ Array [ Object { + "assetType": "All", "first": 0, }, ], diff --git a/typings/CameraRoll.d.ts b/typings/CameraRoll.d.ts index 66c08da5c..c2e417f04 100644 --- a/typings/CameraRoll.d.ts +++ b/typings/CameraRoll.d.ts @@ -29,7 +29,7 @@ export interface GetPhotosParams { groupName?: string, assetType?: AssetType mimeTypes?: Array, -}; +} export interface PhotoIdentifier { node: {