@@ -5,48 +5,53 @@ title: CameraRoll
55
66## Methods
77
8- - ` saveToCameraRoll ` allows saving photos and videos to the Camera Roll or Photo
9- Gallery. File to be saved is specified as a tag which can be
8+ ### ` saveToCameraRoll `
109
11- - on Android, a local image or video URI, such as "file:///sdcard/img.png"
12- - on iOS, a local video URI or any image URI (local, remote asset-library, or
13- base64 data URIs)
10+ Allows saving photos and videos to the Camera Roll or Photo Gallery. File to be
11+ saved is specified as a tag (of type ` string ` ) which can be
12+
13+ - on Android, a local image or video URI, such as "file:///sdcard/img.png"
14+ - on iOS, a local video URI or any image URI (local, remote asset-library, or
15+ base64 data URIs)
1416
1517Media type (photo or video) will be automatically inferred; any file will be
1618inferred to be a photo, unless the file extension is ` mov ` or ` mp4 ` , then it
1719will be inferred to be a video.
1820
21+ The function will return the URI for the saved file as a string wrapped in a
22+ Promise.
23+
1924``` reason
20- saveToCameraRoll(tag )
25+ saveToCameraRoll: string => Js.Promise.t(string )
2126```
2227
23- The function will return the URI for the saved file as a string wrapped in a
24- Promise, ` Js.Promise.t(string) ` .
28+ ### ` saveToCameraRollWithType `
29+
30+ Allows saving photos and videos to the Camera Roll, where the tag will be
31+ specified as above, overriding the automatically determined type by specifying
32+ one of the polymorphic variants `` `photo `` or `` `video `` .
2533
26- - ` saveToCameraRollWithType ` allows saving photos and videos to the Camera Roll,
27- where the tag will be specified as above, overriding the automatically
28- determined type.
34+ The function will return the URI for the saved file as a string wrapped in a
35+ Promise.
2936
3037``` reason
31- saveToCameraRollWithType(tag, _type )
38+ saveToCameraRollWithType: (string, [ | `photo | `video]) => Js.Promise.t(string )
3239```
3340
34- where ` _type ` can be `` `photo `` or `` `video `` .
41+ ### ` getPhotos `
3542
36- The function will return the URI for the saved file as a string wrapped in a
37- Promise, ` Js.Promise.t(string) ` .
43+ Allows searching for photos or videos matching given parameters.
3844
39- - ` getPhotos ` takes as argument ` getPhotosParams `
45+ Takes as argument ` getPhotosParams ` and returns a ` photoIdentifiersPage ` object
46+ wrapped in a Promise. ` edges ` key of the ` photoIdentifiersPage ` object would be
47+ of type ` array(photoIdentifier) ` , where each ` photoIdentifier ` object would
48+ contain details of each photo or video matching parameters provided in the
49+ ` getPhotosParam ` object.
4050
4151``` reason
42- getPhotos( getPhotosParams)
52+ getPhotos: getPhotosParams => Js.Promise.t(photoIdentifiersPage )
4353```
4454
45- The function will return a ` photoIdentifiersPage ` object wrapped in a Promise,
46- that is ` Js.Promise.t(photoIdentifiersPage) ` . Array of ` photoIdentifier ` will
47- contain details of photos or videos matching parameters provided in the
48- ` getPhotosParam ` object.
49-
5055## Types
5156
5257- ` getPhotosParams ` can be constructed with the constructor of the same name
@@ -76,7 +81,7 @@ getPhotosParams:
7681 ~assetType: [@bs.string] [ | `All | `Videos | `Photos]=?,
7782 ~mimeTypes: array(string)=?,
7883 unit
79- )
84+ ) => getPhotosParams
8085```
8186
8287- ` photoIdentifiersPage `
@@ -131,8 +136,8 @@ type photoIdentifier = {
131136``` reason
132137open ReactNative;
133138
134- let windowWidth = float_of_int( Dimensions.get(`window)##width) ;
135- let windowHeight = float_of_int( Dimensions.get(`window)##height) ;
139+ let windowWidth = Dimensions.get(`window)##width;
140+ let windowHeight = Dimensions.get(`window)##height;
136141
137142type state = {
138143 tag: string,
0 commit comments