Skip to content

Commit 4726235

Browse files
update types & add methods
1 parent 5713a54 commit 4726235

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

src/ReactNativeImagePicker.bs.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
'use strict';
22

33

4+
var Button = { };
5+
46
var PermissionDenied = { };
57

68
var $$Storage = { };
79

810
var Options = {
11+
Button: Button,
912
PermissionDenied: PermissionDenied,
1013
Storage: $$Storage
1114
};

src/ReactNativeImagePicker.re

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ module ImagePicker = {
22
module Options = {
33
type t;
44

5+
module Button = {
6+
type t;
7+
8+
[@bs.obj] external make: (~title: string, ~name: string) => t = "";
9+
};
10+
511
module PermissionDenied = {
612
type t;
713

@@ -55,14 +61,43 @@ module ImagePicker = {
5561
~videoQuality: [@bs.string] [ | `low | `medium | `high]=?,
5662
~storageOptions: Storage.t=?,
5763
~permissionDenied: PermissionDenied.t=?,
64+
~customButtons: array(Button.t)=?,
5865
unit
5966
) =>
6067
t =
6168
"";
6269
};
6370

64-
type response = {. "didCancel": bool};
71+
type response = {
72+
.
73+
"didCancel": bool,
74+
"error": string,
75+
"customButton": string,
76+
"data": string,
77+
"uri": string,
78+
"oriURL": string,
79+
"isVertical": bool,
80+
"width": int,
81+
"height": int,
82+
"fileSize": int,
83+
"type": string,
84+
"fileName": string,
85+
"path": string,
86+
"latitude": float,
87+
"longitude": float,
88+
"timestamp": int,
89+
"originalRotation": float,
90+
};
91+
92+
[@bs.module "react-native-image-picker"] [@bs.scope "default"]
93+
external launchCamera: (Options.t, response => unit) => unit =
94+
"launchCamera";
95+
96+
[@bs.module "react-native-image-picker"] [@bs.scope "default"]
97+
external showImagePicker: (Options.t, response => unit) => unit =
98+
"showImagePicker";
6599

66100
[@bs.module "react-native-image-picker"] [@bs.scope "default"]
67-
external launchCamera: Options.t => response = "launchCamera";
101+
external launchImageLibrary: (Options.t, response => unit) => unit =
102+
"launchImageLibrary";
68103
};

0 commit comments

Comments
 (0)