diff --git a/js/CameraRoll.js b/js/CameraRoll.js index 1b8e3a7b3..6f74f72e6 100644 --- a/js/CameraRoll.js +++ b/js/CameraRoll.js @@ -120,7 +120,7 @@ class CameraRoll { console.warn( '`CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead.', ); - return this.saveToCameraRoll(tag, {type: 'photo'}); + return this.saveToCameraRoll(tag, 'photo'); } static deletePhotos(photos: Array) { @@ -157,8 +157,11 @@ class CameraRoll { } return RNCCameraRoll.saveToCameraRoll(tag, {type, album}); } - static saveToCameraRoll(tag: string, type?: photo | video) { - CameraRoll.save(tag, {type}); + static saveToCameraRoll( + tag: string, + type?: 'photo' | 'video' | 'auto', + ): Promise { + return CameraRoll.save(tag, {type}); } /** * Returns a Promise with photo identifier objects from the local camera diff --git a/js/__tests__/CameraRollTest.js b/js/__tests__/CameraRollTest.js index c8642bc5a..320deca95 100644 --- a/js/__tests__/CameraRollTest.js +++ b/js/__tests__/CameraRollTest.js @@ -26,11 +26,10 @@ describe('CameraRoll', () => { }); it('Should call save', async () => { - await CameraRoll.save('a tag', {type:'photo'}); + await CameraRoll.save('a tag', {type: 'photo'}); expect(NativeModule.saveToCameraRoll.mock.calls).toMatchSnapshot(); }); - it('Should call getPhotos', async () => { await CameraRoll.getPhotos({first: 0}); expect(NativeModule.getPhotos.mock.calls).toMatchSnapshot();