Skip to content

Commit 8355a55

Browse files
committed
feat: adds bindings for TouchableNativeFeedback component.
1 parent 01b9403 commit 8355a55

File tree

3 files changed

+290
-0
lines changed

3 files changed

+290
-0
lines changed

lib/js/src/components/touchableNativeFeedback.js

Lines changed: 126 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
[@bs.module "react-native"]
2+
external view : ReasonReact.reactClass = "TouchableNativeFeedback";
3+
4+
type t;
5+
6+
[@bs.module "react-native"] [@bs.scope "TouchableNativeFeedback"]
7+
external selectableBackground : unit => t = "SelectableBackground";
8+
9+
[@bs.module "react-native"] [@bs.scope "TouchableNativeFeedback"]
10+
external selectableBackgroundBorderless : unit => t =
11+
"SelectableBackgroundBorderless";
12+
13+
[@bs.module "react-native"] [@bs.scope "TouchableNativeFeedback"]
14+
external canUseNativeForeground : unit => t = "CanUseNativeForeground";
15+
16+
[@bs.module "react-native"] [@bs.scope "TouchableNativeFeedback"]
17+
external ripple : (string, bool) => t = "Ripple";
18+
19+
let make =
20+
(
21+
~accessible=?,
22+
~accessibilityLabel=?,
23+
~accessibilityComponentType=?,
24+
~accessibilityTraits=?,
25+
~delayLongPress=?,
26+
~delayPressIn=?,
27+
~delayPressOut=?,
28+
~disabled=?,
29+
~hitSlop=?,
30+
~onLayout=?,
31+
~onLongPress=?,
32+
~onPress=?,
33+
~onPressIn=?,
34+
~onPressOut=?,
35+
~pressRetentionOffset=?,
36+
~style=?,
37+
~background=?,
38+
~useForeground=?,
39+
) =>
40+
ReasonReact.wrapJsForReason(
41+
~reactClass=view,
42+
~props=
43+
Js.Undefined.(
44+
{
45+
"accessible": fromOption(UtilsRN.optBoolToOptJsBoolean(accessible)),
46+
"accessibilityLabel": fromOption(accessibilityLabel),
47+
"delayLongPress": fromOption(delayLongPress),
48+
"delayPressIn": fromOption(delayPressIn),
49+
"delayPressOut": fromOption(delayPressOut),
50+
"disabled": fromOption(UtilsRN.optBoolToOptJsBoolean(disabled)),
51+
"hitSlop": fromOption(hitSlop),
52+
"onLayout": fromOption(onLayout),
53+
"onLongPress": fromOption(onLongPress),
54+
"onPress": fromOption(onPress),
55+
"background": fromOption(background),
56+
"onPressIn": fromOption(onPressIn),
57+
"onPressOut": fromOption(onPressOut),
58+
"pressRetentionOffset": fromOption(pressRetentionOffset),
59+
"style": fromOption(style),
60+
"useForeground":
61+
fromOption(UtilsRN.optBoolToOptJsBoolean(useForeground)),
62+
"accessibilityComponentType":
63+
fromOption(
64+
UtilsRN.option_map(
65+
x =>
66+
switch (x) {
67+
| `none => "none"
68+
| `button => "button"
69+
| `radiobutton_checked => "radiobutton_checked-none"
70+
| `radiobutton_unchecked => "radiobutton_unchecked"
71+
},
72+
accessibilityComponentType,
73+
),
74+
),
75+
"accessibilityTraits":
76+
fromOption(
77+
UtilsRN.option_map(
78+
traits => {
79+
let to_string =
80+
fun
81+
| `none => "none"
82+
| `button => "button"
83+
| `link => "link"
84+
| `header => "header"
85+
| `search => "search"
86+
| `image => "image"
87+
| `selected => "selected"
88+
| `plays => "plays"
89+
| `key => "key"
90+
| `text => "text"
91+
| `summary => "summary"
92+
| `disabled => "disabled"
93+
| `frequentUpdates => "frequentUpdates"
94+
| `startsMedia => "startsMedia"
95+
| `adjustable => "adjustable"
96+
| `allowsDirectInteraction => "allowsDirectInteraction"
97+
| `pageTurn => "pageTurn";
98+
traits |> List.map(to_string) |> Array.of_list;
99+
},
100+
accessibilityTraits,
101+
),
102+
),
103+
}
104+
),
105+
);
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
type t;
2+
let selectableBackground: unit => t;
3+
let selectableBackgroundBorderless: unit => t;
4+
let canUseNativeForeground: unit => t;
5+
let ripple: (string, bool) => t;
6+
let make:
7+
(
8+
~accessible: bool=?,
9+
~accessibilityLabel: string=?,
10+
~accessibilityComponentType: [
11+
| `none
12+
| `button
13+
| `radiobutton_checked
14+
| `radiobutton_unchecked
15+
]
16+
=?,
17+
~accessibilityTraits: list(
18+
[
19+
| `none
20+
| `button
21+
| `link
22+
| `header
23+
| `search
24+
| `image
25+
| `selected
26+
| `plays
27+
| `key
28+
| `text
29+
| `summary
30+
| `disabled
31+
| `frequentUpdates
32+
| `startsMedia
33+
| `adjustable
34+
| `allowsDirectInteraction
35+
| `pageTurn
36+
],
37+
)
38+
=?,
39+
~delayLongPress: int=?,
40+
~delayPressIn: int=?,
41+
~delayPressOut: int=?,
42+
~disabled: bool=?,
43+
~hitSlop: Types.insets=?,
44+
~onLayout: RNEvent.NativeLayoutEvent.t => unit=?,
45+
~onLongPress: unit => unit=?,
46+
~onPress: unit => unit=?,
47+
~onPressIn: unit => unit=?,
48+
~onPressOut: unit => unit=?,
49+
~pressRetentionOffset: Types.insets=?,
50+
~style: Style.t=?,
51+
~background: t=?,
52+
~useForeground: bool=?,
53+
array(ReasonReact.reactElement)
54+
) =>
55+
ReasonReact.component(
56+
ReasonReact.stateless,
57+
ReasonReact.noRetainedProps,
58+
unit,
59+
);

0 commit comments

Comments
 (0)