Skip to content

Commit bc9422c

Browse files
authored
Zero-cost bindings to ImagePickerIOS (#395)
1 parent c374353 commit bc9422c

3 files changed

Lines changed: 86 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
id: apis/ImagePickerIOS
3+
title: ImagePickerIOS
4+
wip: true
5+
---
6+
7+
```reason
8+
type imageUri = string;
9+
10+
[@bs.module "react-native"] [@bs.scope "ImagePickerIOS"]
11+
external canUseCamera: (bool => unit) => unit = "";
12+
13+
[@bs.module "react-native"] [@bs.scope "ImagePickerIOS"]
14+
external canRecordVideos: (bool => unit) => unit = "";
15+
16+
type cameraDialogConfig;
17+
[@bs.obj]
18+
external cameraDialogConfig: (~videoMode: bool=?, unit) => cameraDialogConfig =
19+
"";
20+
21+
type selectDialogConfig;
22+
[@bs.obj]
23+
external selectDialogConfig:
24+
(~showImages: bool=?, ~showVideos: bool=?, unit) => selectDialogConfig =
25+
"";
26+
27+
[@bs.module "react-native"] [@bs.scope "ImagePickerIOS"]
28+
external openCameraDialog:
29+
(
30+
~config: cameraDialogConfig,
31+
~onSuccess: imageUri => unit,
32+
~onError: 'error => unit
33+
) =>
34+
unit =
35+
"";
36+
37+
[@bs.module "react-native"] [@bs.scope "ImagePickerIOS"]
38+
external openSelectDialog:
39+
(
40+
~config: selectDialogConfig,
41+
~onSuccess: imageUri => unit,
42+
~onError: 'error => unit
43+
) =>
44+
unit =
45+
"";
46+
47+
```
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
type imageUri = string;
2+
3+
[@bs.module "react-native"] [@bs.scope "ImagePickerIOS"]
4+
external canUseCamera: (bool => unit) => unit = "";
5+
6+
[@bs.module "react-native"] [@bs.scope "ImagePickerIOS"]
7+
external canRecordVideos: (bool => unit) => unit = "";
8+
9+
type cameraDialogConfig;
10+
[@bs.obj]
11+
external cameraDialogConfig: (~videoMode: bool=?, unit) => cameraDialogConfig =
12+
"";
13+
14+
type selectDialogConfig;
15+
[@bs.obj]
16+
external selectDialogConfig:
17+
(~showImages: bool=?, ~showVideos: bool=?, unit) => selectDialogConfig =
18+
"";
19+
20+
[@bs.module "react-native"] [@bs.scope "ImagePickerIOS"]
21+
external openCameraDialog:
22+
(
23+
~config: cameraDialogConfig,
24+
~onSuccess: imageUri => unit,
25+
~onError: 'error => unit
26+
) =>
27+
unit =
28+
"";
29+
30+
[@bs.module "react-native"] [@bs.scope "ImagePickerIOS"]
31+
external openSelectDialog:
32+
(
33+
~config: selectDialogConfig,
34+
~onSuccess: imageUri => unit,
35+
~onError: 'error => unit
36+
) =>
37+
unit =
38+
"";

0 commit comments

Comments
 (0)