[CameraRoll] support fetching videos from the camera roll

Summary:
This adds a parameter for fetching videos from the camera roll. It also changes the default to fetch both videos and photos.
Closes https://github.com/facebook/react-native/pull/774
Github Author: Joshua Sierles <joshua@diluvia.net>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
Joshua Sierles 2015-06-01 15:46:06 -07:00
parent 9eeeae9005
commit 6b163a4a9a
1 changed files with 15 additions and 0 deletions

View File

@ -29,8 +29,16 @@ var GROUP_TYPES_OPTIONS = [
'SavedPhotos', // default 'SavedPhotos', // default
]; ];
var ASSET_TYPE_OPTIONS = [
'All',
'Videos',
'Photos', // default
];
// Flow treats Object and Array as disjoint types, currently. // Flow treats Object and Array as disjoint types, currently.
deepFreezeAndThrowOnMutationInDev((GROUP_TYPES_OPTIONS: any)); deepFreezeAndThrowOnMutationInDev((GROUP_TYPES_OPTIONS: any));
deepFreezeAndThrowOnMutationInDev((ASSET_TYPE_OPTIONS: any));
/** /**
* Shape of the param arg for the `getPhotos` function. * Shape of the param arg for the `getPhotos` function.
@ -58,6 +66,11 @@ var getPhotosParamChecker = createStrictShapeTypeChecker({
* titles. * titles.
*/ */
groupName: ReactPropTypes.string, groupName: ReactPropTypes.string,
/**
* Specifies filter on asset type
*/
assetType: ReactPropTypes.oneOf(ASSET_TYPE_OPTIONS),
}); });
/** /**
@ -94,6 +107,7 @@ var getPhotosReturnChecker = createStrictShapeTypeChecker({
class CameraRoll { class CameraRoll {
static GroupTypesOptions: Array<string>; static GroupTypesOptions: Array<string>;
static AssetTypeOptions: Array<string>;
/** /**
* Saves the image with tag `tag` to the camera roll. * Saves the image with tag `tag` to the camera roll.
* *
@ -154,5 +168,6 @@ class CameraRoll {
} }
CameraRoll.GroupTypesOptions = GROUP_TYPES_OPTIONS; CameraRoll.GroupTypesOptions = GROUP_TYPES_OPTIONS;
CameraRoll.AssetTypeOptions = ASSET_TYPE_OPTIONS;
module.exports = CameraRoll; module.exports = CameraRoll;