Skip to content

Commit 4fe7605

Browse files
committed
feat: Brings bindings for viewPagerAndroid component.
1 parent 01b9403 commit 4fe7605

File tree

3 files changed

+198
-0
lines changed

3 files changed

+198
-0
lines changed

lib/js/src/components/viewPagerAndroid.js

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

src/components/viewPagerAndroid.re

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
[@bs.module "react-native"]
2+
external view : ReasonReact.reactClass = "ViewPagerAndroid";
3+
4+
[@bs.send] external setPage : (ReasonReact.reactRef, int) => unit = "";
5+
6+
let make =
7+
(
8+
~initialPage=?,
9+
~keyboardDismissMode=?,
10+
~onPageScroll=?,
11+
~onPageScrollStateChanged=?,
12+
~onPageSelected=?,
13+
~pageMargin=?,
14+
~peekEnabled=?,
15+
~scrollEnabled=?,
16+
~accessibilityLabel=?,
17+
~accessible=?,
18+
~hitSlop=?,
19+
~onAccessibilityTap=?,
20+
~onLayout=?,
21+
~onMagicTap=?,
22+
~responderHandlers=?,
23+
~pointerEvents=?,
24+
~removeClippedSubviews=?,
25+
~style=?,
26+
~testID=?,
27+
~accessibilityComponentType=?,
28+
~accessibilityLiveRegion=?,
29+
~collapsable=?,
30+
~importantForAccessibility=?,
31+
~needsOffscreenAlphaCompositing=?,
32+
~renderToHardwareTextureAndroid=?,
33+
~accessibilityTraits=?,
34+
~accessibilityViewIsModal=?,
35+
~shouldRasterizeIOS=?,
36+
) =>
37+
ReasonReact.wrapJsForReason(
38+
~reactClass=view,
39+
~props=
40+
Props.extendView(
41+
Js.Undefined.(
42+
{
43+
"initialPage": fromOption(initialPage),
44+
"onPageScroll": fromOption(onPageScroll),
45+
"onPageScrollStateChanged": fromOption(onPageScrollStateChanged),
46+
"onPageSelected": fromOption(onPageSelected),
47+
"pageMargin": fromOption(pageMargin),
48+
"keyboardDismissMode":
49+
fromOption(
50+
UtilsRN.option_map(
51+
fun
52+
| `none => "none"
53+
| `onDrag => "on-drag",
54+
keyboardDismissMode,
55+
),
56+
),
57+
"peekEnabled": fromOption(peekEnabled),
58+
"scrollEnabled": fromOption(scrollEnabled),
59+
}
60+
),
61+
~accessibilityLabel?,
62+
~accessible?,
63+
~hitSlop?,
64+
~onAccessibilityTap?,
65+
~onLayout?,
66+
~onMagicTap?,
67+
~responderHandlers?,
68+
~pointerEvents?,
69+
~removeClippedSubviews?,
70+
~style?,
71+
~testID?,
72+
~accessibilityComponentType?,
73+
~accessibilityLiveRegion?,
74+
~collapsable?,
75+
~importantForAccessibility?,
76+
~needsOffscreenAlphaCompositing?,
77+
~renderToHardwareTextureAndroid?,
78+
~accessibilityTraits?,
79+
~accessibilityViewIsModal?,
80+
~shouldRasterizeIOS?,
81+
),
82+
);
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
let setPage: (ReasonReact.reactRef, int) => unit;
2+
3+
let make:
4+
(
5+
~initialPage: int=?,
6+
~keyboardDismissMode: [ | `none | `onDrag]=?,
7+
~onPageScroll: {
8+
.
9+
"nativeEvent": {
10+
.
11+
"position": int,
12+
"offset": int,
13+
},
14+
} =>
15+
unit
16+
=?,
17+
~onPageScrollStateChanged: string => unit=?,
18+
~onPageSelected: {. "nativeEvent": {. "position": int}} => unit=?,
19+
~pageMargin: int=?,
20+
~peekEnabled: bool=?,
21+
~scrollEnabled: bool=?,
22+
/* view props: */
23+
~accessibilityLabel: string=?,
24+
~accessible: bool=?,
25+
~hitSlop: Types.insets=?,
26+
~onAccessibilityTap: unit => unit=?,
27+
~onLayout: RNEvent.NativeLayoutEvent.t => unit=?,
28+
~onMagicTap: unit => unit=?,
29+
~responderHandlers: Types.touchResponderHandlers=?,
30+
~pointerEvents: [ | `auto | `boxNone | `boxOnly | `none]=?,
31+
~removeClippedSubviews: bool=?,
32+
~style: Style.t=?,
33+
~testID: string=?,
34+
~accessibilityComponentType: [
35+
| `button
36+
| `none
37+
| `radiobutton_checked
38+
| `radiobutton_unchecked
39+
]
40+
=?,
41+
~accessibilityLiveRegion: [ | `assertive | `none | `polite]=?,
42+
~collapsable: bool=?,
43+
~importantForAccessibility: [ | `auto | `no | `noHideDescendants | `yes]=?,
44+
~needsOffscreenAlphaCompositing: bool=?,
45+
~renderToHardwareTextureAndroid: bool=?,
46+
~accessibilityTraits: list(
47+
[
48+
| `adjustable
49+
| `allowsDirectInteraction
50+
| `button
51+
| `disabled
52+
| `frequentUpdates
53+
| `header
54+
| `image
55+
| `key
56+
| `link
57+
| `none
58+
| `pageTurn
59+
| `plays
60+
| `search
61+
| `selected
62+
| `startsMedia
63+
| `summary
64+
| `text
65+
],
66+
)
67+
=?,
68+
~accessibilityViewIsModal: bool=?,
69+
~shouldRasterizeIOS: bool=?,
70+
array(ReasonReact.reactElement)
71+
) =>
72+
ReasonReact.component(
73+
ReasonReact.stateless,
74+
ReasonReact.noRetainedProps,
75+
unit,
76+
);

0 commit comments

Comments
 (0)