Module CameraRoll-BsReactNative

type cursor;

CameraRoll provides access to the local camera roll or photo library.

On iOS, the CameraRoll API requires the RCTCameraRoll library to be linked

You can read more on CameraRoll API usage in official docs: https://facebook.github.io/react-native/docs/cameraroll

Types

cursor
type cursor;
node
  type node = {
  .
  "_type": string,
  "group_name": string,
  "image": {
    .
    "filename": string,
    "height": int,
    "isStored": bool,
    "playableDuration": int,
    "uri": string,
    "width": int,
  },
  "location": {
    .
    "altitude": float,
    "heading": float,
    "latitude": float,
    "longitude": float,
    "speed": float,
  },
  "timestamp": float,
};
assets
  type assets = {
  .
  "edges": array({. "node": node}),
  "page_info": {
    .
    "end_cursor": cursor,
    "has_next_page": bool,
    "start_cursor": cursor,
  },
};
filetype
type fileType =
| Video
| Photo;
groupType
type groupType =
| All
| Album
| Event
| Faces
| Library
| PhotoStream
| SavedPhotos;
assetType
type assetType =
| All
| Videos
| Photos;

Methods

saveToCameraRoll
let saveToCameraRoll:
(~uri: string, ~type_: fileType=?, unit) =>
Js.Promise.t(Belt.Result.t(string, Js.Promise.error));
getPhotos
let getPhotos:
(
  ~first: int,
  ~after: cursor=?,
  ~groupTypes: groupType=?,
  ~groupName: string=?,
  ~assetType: assetType=?,
  ~mimeTypes: string=?,
  unit
) =>
Js.Promise.t(assets);
type node = Js.t({. _type: string, group_name: string, image: Js.t({. filename: string, height: int, isStored: bool, playableDuration: int, uri: string, width: int, }), location: Js.t({. altitude: float, heading: float, latitude: float, longitude: float, speed: float, }), timestamp: float, });
type assets = Js.t({. edges: array(Js.t({. node: node, })), page_info: Js.t({. end_cursor: cursor, has_next_page: bool, start_cursor: cursor, }), });
type fileType =
| Video
| Photo
;
type groupType =
| All
| Album
| Event
| Faces
| Library
| PhotoStream
| SavedPhotos
;
type assetType =
| All
| Videos
| Photos
;
let saveToCameraRoll: uri:string => ?⁠type_:fileType => unit => Js.Promise.t(Belt.Result.t(string, Js.Promise.error));
let getPhotos: first:int => ?⁠after:cursor => ?⁠groupTypes:groupType => ?⁠groupName:string => ?⁠assetType:assetType => ?⁠mimeTypes:string => unit => Js.Promise.t(assets);