Skip to content

Commit b2472fa

Browse files
authored
Merge pull request #139 from mobily/actionsheetios-module
ActionSheetIOS — bindings
2 parents 867fbc8 + badb138 commit b2472fa

File tree

4 files changed

+158
-1
lines changed

4 files changed

+158
-1
lines changed

STATUS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
## APIs
4545
- [ ] AccessibilityInfo
46-
- [ ] ActionSheetIOS
46+
- [x] ActionSheetIOS
4747
- [ ] AdSupportIOS
4848
- [x] Alert
4949
- [x] AlertIOS

lib/js/src/actionSheetIOS.js

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/actionSheetIOS.re

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
type actionSheetConfig;
2+
3+
type shareActionSheetConfig;
4+
5+
type error;
6+
7+
[@bs.obj]
8+
external makeActionSheetConfig :
9+
(
10+
~options: array(string),
11+
~cancelButtonIndex: int=?,
12+
~destructiveButtonIndex: int=?,
13+
~title: string=?,
14+
~message: string=?,
15+
~tintColor: string=?
16+
) =>
17+
actionSheetConfig =
18+
"";
19+
20+
[@bs.obj]
21+
external makeShareActionSheetConfig :
22+
(
23+
~message: string=?,
24+
~url: string=?,
25+
~subject: string=?,
26+
~excludedActivityTypes: array(string)=?
27+
) =>
28+
shareActionSheetConfig =
29+
"";
30+
31+
[@bs.module "react-native"] [@bs.scope "ActionSheetIOS"]
32+
external _showActionSheetWithOptions : (actionSheetConfig, int => unit) => unit =
33+
"showActionSheetWithOptions";
34+
35+
[@bs.module "react-native"] [@bs.scope "ActionSheetIOS"]
36+
external _showShareActionSheetWithOptions :
37+
(shareActionSheetConfig, error => unit, (bool, string) => unit) => unit =
38+
"showShareActionSheetWithOptions";
39+
40+
let showActionSheetWithOptions =
41+
(
42+
~options,
43+
~cancelButtonIndex=?,
44+
~destructiveButtonIndex=?,
45+
~title=?,
46+
~message=?,
47+
~tintColor=?,
48+
callback,
49+
()
50+
) =>
51+
_showActionSheetWithOptions(
52+
makeActionSheetConfig(
53+
~options,
54+
~cancelButtonIndex?,
55+
~destructiveButtonIndex?,
56+
~title?,
57+
~message?,
58+
~tintColor?
59+
),
60+
callback
61+
);
62+
63+
let showShareActionSheetWithOptions =
64+
(
65+
~message=?,
66+
~url=?,
67+
~subject=?,
68+
~excludedActivityTypes=?,
69+
failureCallback,
70+
successCallback,
71+
()
72+
) =>
73+
_showShareActionSheetWithOptions(
74+
makeShareActionSheetConfig(
75+
~message?,
76+
~url?,
77+
~subject?,
78+
~excludedActivityTypes?
79+
),
80+
failureCallback,
81+
successCallback
82+
);

src/actionSheetIOS.rei

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
type error;
2+
3+
let showActionSheetWithOptions:
4+
(
5+
~options: array(string),
6+
~cancelButtonIndex: int=?,
7+
~destructiveButtonIndex: int=?,
8+
~title: string=?,
9+
~message: string=?,
10+
~tintColor: string=?,
11+
int => unit,
12+
unit
13+
) =>
14+
unit;
15+
16+
let showShareActionSheetWithOptions:
17+
(
18+
~message: string=?,
19+
~url: string=?,
20+
~subject: string=?,
21+
~excludedActivityTypes: array(string)=?,
22+
error => unit,
23+
(bool, string) => unit,
24+
unit
25+
) =>
26+
unit;

0 commit comments

Comments
 (0)