mirror of
https://github.com/status-im/react-native-cameraroll.git
synced 2025-02-04 13:53:27 +00:00
fix(lib): fix issue with CameraRoll.saveImageWithTag and new save function with options
This commit is contained in:
parent
c958493441
commit
7519cb5fa8
@ -120,7 +120,7 @@ class CameraRoll {
|
|||||||
console.warn(
|
console.warn(
|
||||||
'`CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead.',
|
'`CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead.',
|
||||||
);
|
);
|
||||||
return this.saveToCameraRoll(tag, {type: 'photo'});
|
return this.saveToCameraRoll(tag, 'photo');
|
||||||
}
|
}
|
||||||
|
|
||||||
static deletePhotos(photos: Array<string>) {
|
static deletePhotos(photos: Array<string>) {
|
||||||
@ -157,8 +157,11 @@ class CameraRoll {
|
|||||||
}
|
}
|
||||||
return RNCCameraRoll.saveToCameraRoll(tag, {type, album});
|
return RNCCameraRoll.saveToCameraRoll(tag, {type, album});
|
||||||
}
|
}
|
||||||
static saveToCameraRoll(tag: string, type?: photo | video) {
|
static saveToCameraRoll(
|
||||||
CameraRoll.save(tag, {type});
|
tag: string,
|
||||||
|
type?: 'photo' | 'video' | 'auto',
|
||||||
|
): Promise<string> {
|
||||||
|
return CameraRoll.save(tag, {type});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns a Promise with photo identifier objects from the local camera
|
* Returns a Promise with photo identifier objects from the local camera
|
||||||
|
@ -26,11 +26,10 @@ describe('CameraRoll', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Should call save', async () => {
|
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();
|
expect(NativeModule.saveToCameraRoll.mock.calls).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('Should call getPhotos', async () => {
|
it('Should call getPhotos', async () => {
|
||||||
await CameraRoll.getPhotos({first: 0});
|
await CameraRoll.getPhotos({first: 0});
|
||||||
expect(NativeModule.getPhotos.mock.calls).toMatchSnapshot();
|
expect(NativeModule.getPhotos.mock.calls).toMatchSnapshot();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user