Skip to content

Commit 02aec5b

Browse files
sgnyMoOx
authored andcommitted
Zero-cost bindings to ViewPagerAndroid (#439)
1 parent 32fad52 commit 02aec5b

3 files changed

Lines changed: 206 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: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
id: components/ViewPagerAndroid
3+
title: ViewPagerAndroid
4+
wip: true
5+
---
6+
7+
```reason
8+
type element;
9+
type ref = React.Ref.t(Js.nullable(element));
10+
11+
[@react.component] [@bs.module "react-native"]
12+
external make:
13+
(
14+
~ref: ref=?,
15+
~initialPage: int=?,
16+
~keyboardDismissMode: [@bs.string] [ | `none | [@bs.as "on-drag"] `onDrag]
17+
=?,
18+
~onPageScroll: Event.syntheticEvent({
19+
.
20+
"position": int,
21+
"offset": float,
22+
}) =>
23+
unit
24+
=?,
25+
~onPageScrollStateChanged: AndroidInteractionState.t => unit=?,
26+
~onPageSelected: Event.syntheticEvent({. "position": int}) => unit=?,
27+
~pageMargin: int=?,
28+
~peekEnabled: bool=?,
29+
~scrollEnabled: bool=?,
30+
// View props
31+
~accessibilityComponentType: [@bs.string] [
32+
| `none
33+
| `button
34+
| `radiobutton_checked
35+
| `radiobutton_unchecked
36+
]
37+
=?,
38+
~accessibilityElementsHidden: bool=?,
39+
~accessibilityHint: string=?,
40+
~accessibilityIgnoresInvertColors: bool=?,
41+
~accessibilityLabel: string=?,
42+
~accessibilityLiveRegion: [@bs.string] [ | `none | `polite | `assertive]=?,
43+
~accessibilityRole: [@bs.string] [
44+
| `none
45+
| `button
46+
| `link
47+
| `search
48+
| `image
49+
| `keyboardkey
50+
| `text
51+
| `adjustable
52+
| `header
53+
| `summary
54+
| `imagebutton
55+
]
56+
=?,
57+
~accessibilityStates: array(AccessibilityState.t)=?,
58+
~accessibilityTraits: array(AccessibilityTrait.t)=?,
59+
~accessibilityViewIsModal: bool=?,
60+
~accessible: bool=?,
61+
~collapsable: bool=?,
62+
~hitSlop: Types.edgeInsets=?,
63+
~importantForAccessibility: [@bs.string] [
64+
| `auto
65+
| `yes
66+
| `no
67+
| [@bs.as "no-hide-descendants"]
68+
`noHideDescendants
69+
]
70+
=?,
71+
~nativeID: string=?,
72+
~needsOffscreenAlphaCompositing: bool=?,
73+
~onAccessibilityTap: unit => unit=?,
74+
~onLayout: Event.layoutEvent => unit=?,
75+
~onMagicTap: unit => unit=?,
76+
// Gesture Responder props
77+
~onMoveShouldSetResponder: Event.pressEvent => bool=?,
78+
~onMoveShouldSetResponderCapture: Event.pressEvent => bool=?,
79+
~onResponderGrant: Event.pressEvent => unit=?,
80+
~onResponderMove: Event.pressEvent => unit=?,
81+
~onResponderReject: Event.pressEvent => unit=?,
82+
~onResponderRelease: Event.pressEvent => unit=?,
83+
~onResponderTerminate: Event.pressEvent => unit=?,
84+
~onResponderTerminationRequest: Event.pressEvent => unit=?,
85+
~onStartShouldSetResponder: Event.pressEvent => bool=?,
86+
~onStartShouldSetResponderCapture: Event.pressEvent => bool=?,
87+
~pointerEvents: [@bs.string] [
88+
| `auto
89+
| `none
90+
| [@bs.as "box-none"] `boxNone
91+
| [@bs.as "box-only"] `boxOnly
92+
]
93+
=?,
94+
~removeClippedSubviews: bool=?,
95+
~renderToHardwareTextureAndroid: bool=?,
96+
~shouldRasterizeIOS: bool=?,
97+
~style: Style.t=?,
98+
~testID: string=?
99+
) =>
100+
React.element =
101+
"ViewPagerAndroid";
102+
103+
[@bs.send] external setPage: (element, int) => unit = "";
104+
105+
[@bs.send] external setPageWithoutAnimation: (element, int) => unit = "";
106+
107+
```
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
type element;
2+
type ref = React.Ref.t(Js.nullable(element));
3+
4+
[@react.component] [@bs.module "react-native"]
5+
external make:
6+
(
7+
~ref: ref=?,
8+
~initialPage: int=?,
9+
~keyboardDismissMode: [@bs.string] [ | `none | [@bs.as "on-drag"] `onDrag]
10+
=?,
11+
~onPageScroll: Event.syntheticEvent({
12+
.
13+
"position": int,
14+
"offset": float,
15+
}) =>
16+
unit
17+
=?,
18+
~onPageScrollStateChanged: AndroidInteractionState.t => unit=?,
19+
~onPageSelected: Event.syntheticEvent({. "position": int}) => unit=?,
20+
~pageMargin: int=?,
21+
~peekEnabled: bool=?,
22+
~scrollEnabled: bool=?,
23+
// View props
24+
~accessibilityComponentType: [@bs.string] [
25+
| `none
26+
| `button
27+
| `radiobutton_checked
28+
| `radiobutton_unchecked
29+
]
30+
=?,
31+
~accessibilityElementsHidden: bool=?,
32+
~accessibilityHint: string=?,
33+
~accessibilityIgnoresInvertColors: bool=?,
34+
~accessibilityLabel: string=?,
35+
~accessibilityLiveRegion: [@bs.string] [ | `none | `polite | `assertive]=?,
36+
~accessibilityRole: [@bs.string] [
37+
| `none
38+
| `button
39+
| `link
40+
| `search
41+
| `image
42+
| `keyboardkey
43+
| `text
44+
| `adjustable
45+
| `header
46+
| `summary
47+
| `imagebutton
48+
]
49+
=?,
50+
~accessibilityStates: array(AccessibilityState.t)=?,
51+
~accessibilityTraits: array(AccessibilityTrait.t)=?,
52+
~accessibilityViewIsModal: bool=?,
53+
~accessible: bool=?,
54+
~collapsable: bool=?,
55+
~hitSlop: Types.edgeInsets=?,
56+
~importantForAccessibility: [@bs.string] [
57+
| `auto
58+
| `yes
59+
| `no
60+
| [@bs.as "no-hide-descendants"]
61+
`noHideDescendants
62+
]
63+
=?,
64+
~nativeID: string=?,
65+
~needsOffscreenAlphaCompositing: bool=?,
66+
~onAccessibilityTap: unit => unit=?,
67+
~onLayout: Event.layoutEvent => unit=?,
68+
~onMagicTap: unit => unit=?,
69+
// Gesture Responder props
70+
~onMoveShouldSetResponder: Event.pressEvent => bool=?,
71+
~onMoveShouldSetResponderCapture: Event.pressEvent => bool=?,
72+
~onResponderGrant: Event.pressEvent => unit=?,
73+
~onResponderMove: Event.pressEvent => unit=?,
74+
~onResponderReject: Event.pressEvent => unit=?,
75+
~onResponderRelease: Event.pressEvent => unit=?,
76+
~onResponderTerminate: Event.pressEvent => unit=?,
77+
~onResponderTerminationRequest: Event.pressEvent => unit=?,
78+
~onStartShouldSetResponder: Event.pressEvent => bool=?,
79+
~onStartShouldSetResponderCapture: Event.pressEvent => bool=?,
80+
~pointerEvents: [@bs.string] [
81+
| `auto
82+
| `none
83+
| [@bs.as "box-none"] `boxNone
84+
| [@bs.as "box-only"] `boxOnly
85+
]
86+
=?,
87+
~removeClippedSubviews: bool=?,
88+
~renderToHardwareTextureAndroid: bool=?,
89+
~shouldRasterizeIOS: bool=?,
90+
~style: Style.t=?,
91+
~testID: string=?
92+
) =>
93+
React.element =
94+
"ViewPagerAndroid";
95+
96+
[@bs.send] external setPage: (element, int) => unit = "";
97+
98+
[@bs.send] external setPageWithoutAnimation: (element, int) => unit = "";

0 commit comments

Comments
 (0)