fix warning about async CameraRoll.getPhotos

Differential Revision: D3065326

fb-gh-sync-id: fea016f0f14078d61d4becf9f9bcbca4fe1f1d92
shipit-source-id: fea016f0f14078d61d4becf9f9bcbca4fe1f1d92
This commit is contained in:
Jiajie Zhu 2016-03-18 10:20:07 -07:00 committed by Facebook Github Bot 1
parent 20ca4fb88b
commit 282df26c19
1 changed files with 6 additions and 6 deletions

View File

@ -135,9 +135,9 @@ class CameraRoll {
'CameraRoll.saveImageWithTag tag must be a valid string.' 'CameraRoll.saveImageWithTag tag must be a valid string.'
); );
if (arguments.length > 1) { if (arguments.length > 1) {
console.warn("CameraRoll.saveImageWithTag(tag, success, error) is deprecated. Use the returned Promise instead"); console.warn('CameraRoll.saveImageWithTag(tag, success, error) is deprecated. Use the returned Promise instead');
let successCallback = arguments[1]; const successCallback = arguments[1];
let errorCallback = arguments[2] || ( () => {} ); const errorCallback = arguments[2] || ( () => {} );
RCTCameraRollManager.saveImageWithTag(tag).then(successCallback, errorCallback); RCTCameraRollManager.saveImageWithTag(tag).then(successCallback, errorCallback);
return; return;
} }
@ -157,10 +157,10 @@ class CameraRoll {
getPhotosParamChecker({params}, 'params', 'CameraRoll.getPhotos'); getPhotosParamChecker({params}, 'params', 'CameraRoll.getPhotos');
} }
if (arguments.length > 1) { if (arguments.length > 1) {
console.warn("CameraRoll.getPhotos(tag, success, error) is deprecated. Use the returned Promise instead"); console.warn('CameraRoll.getPhotos(tag, success, error) is deprecated. Use the returned Promise instead');
let successCallback = arguments[1]; let successCallback = arguments[1];
if (__DEV__) { if (__DEV__) {
let callback = arguments[1]; const callback = arguments[1];
successCallback = (response) => { successCallback = (response) => {
getPhotosReturnChecker( getPhotosReturnChecker(
{response}, {response},
@ -170,7 +170,7 @@ class CameraRoll {
callback(response); callback(response);
}; };
} }
let errorCallback = arguments[2] || ( () => {} ); const errorCallback = arguments[2] || ( () => {} );
RCTCameraRollManager.getPhotos(params).then(successCallback, errorCallback); RCTCameraRollManager.getPhotos(params).then(successCallback, errorCallback);
} }
// TODO: Add the __DEV__ check back in to verify the Promise result // TODO: Add the __DEV__ check back in to verify the Promise result