-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (25 loc) · 802 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {
Platform,
NativeModules,
CameraRoll
} from 'react-native'
var RCTCameraRollManager = NativeModules.CameraRollExtendedManager;
class CameraRollExtended {
static saveImageWithTag(tag: Object): Promise<Object> {
console.warn('CameraRoll.saveImageWithTag is deprecated. Use CameraRoll.saveToCameraRoll instead');
return this.saveToCameraRoll(tag, 'photo');
}
static saveToCameraRoll(tag: Object, type?: 'photo' | 'video'): Promise<Object> {
let mediaType = 'photo';
if (type) {
mediaType = type;
} else if (['mov', 'mp4'].indexOf(tag.split('.').slice(-1)[0]) >= 0) {
mediaType = 'video';
}
return RCTCameraRollManager.saveToCameraRoll(tag, mediaType);
}
static getPhotos(params) {
return CameraRoll.getPhotos(params)
}
}
module.exports = CameraRollExtended