Skip to content

Commit 2b0035b

Browse files
sgnyMoOx
authored andcommitted
Zero-cost bindings to DatePickerIOS (#431)
1 parent 787797e commit 2b0035b

3 files changed

Lines changed: 212 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: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
id: components/DatePickerIOS
3+
title: DatePickerIOS
4+
wip: true
5+
---
6+
7+
```reason
8+
// For localeId refer to
9+
// https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html
10+
11+
type localeId = string;
12+
13+
[@react.component] [@bs.module "react-native"]
14+
external make:
15+
(
16+
~date: Js.Date.t,
17+
~onDateChange: Js.Date.t => unit,
18+
~maximumDate: Js.Date.t=?,
19+
~minimumDate: Js.Date.t=?,
20+
~minuteInterval: [@bs.string] [
21+
| [@bs.as "1"] `_1
22+
| [@bs.as "2"] `_2
23+
| [@bs.as "3"] `_3
24+
| [@bs.as "4"] `_4
25+
| [@bs.as "5"] `_5
26+
| [@bs.as "6"] `_6
27+
| [@bs.as "10"] `_10
28+
| [@bs.as "12"] `_12
29+
| [@bs.as "15"] `_15
30+
| [@bs.as "20"] `_20
31+
| [@bs.as "30"] `_30
32+
]
33+
=?,
34+
~mode: [@bs.string] [ | `date | `time | `datetime]=?,
35+
~locale: localeId=?,
36+
~timeZoneOffsetInMinutes: int=?,
37+
// View props
38+
~accessibilityComponentType: [@bs.string] [
39+
| `none
40+
| `button
41+
| `radiobutton_checked
42+
| `radiobutton_unchecked
43+
]
44+
=?,
45+
~accessibilityElementsHidden: bool=?,
46+
~accessibilityHint: string=?,
47+
~accessibilityIgnoresInvertColors: bool=?,
48+
~accessibilityLabel: string=?,
49+
~accessibilityLiveRegion: [@bs.string] [ | `none | `polite | `assertive]=?,
50+
~accessibilityRole: [@bs.string] [
51+
| `none
52+
| `button
53+
| `link
54+
| `search
55+
| `image
56+
| `keyboardkey
57+
| `text
58+
| `adjustable
59+
| `header
60+
| `summary
61+
| `imagebutton
62+
]
63+
=?,
64+
~accessibilityStates: array(AccessibilityState.t)=?,
65+
~accessibilityTraits: array(AccessibilityTrait.t)=?,
66+
~accessibilityViewIsModal: bool=?,
67+
~accessible: bool=?,
68+
~collapsable: bool=?,
69+
~hitSlop: Types.edgeInsets=?,
70+
~importantForAccessibility: [@bs.string] [
71+
| `auto
72+
| `yes
73+
| `no
74+
| [@bs.as "no-hide-descendants"]
75+
`noHideDescendants
76+
]
77+
=?,
78+
~nativeID: string=?,
79+
~needsOffscreenAlphaCompositing: bool=?,
80+
~onAccessibilityTap: unit => unit=?,
81+
~onLayout: Event.layoutEvent => unit=?,
82+
~onMagicTap: unit => unit=?,
83+
// Gesture Responder props
84+
~onMoveShouldSetResponder: Event.pressEvent => bool=?,
85+
~onMoveShouldSetResponderCapture: Event.pressEvent => bool=?,
86+
~onResponderGrant: Event.pressEvent => unit=?,
87+
~onResponderMove: Event.pressEvent => unit=?,
88+
~onResponderReject: Event.pressEvent => unit=?,
89+
~onResponderRelease: Event.pressEvent => unit=?,
90+
~onResponderTerminate: Event.pressEvent => unit=?,
91+
~onResponderTerminationRequest: Event.pressEvent => unit=?,
92+
~onStartShouldSetResponder: Event.pressEvent => bool=?,
93+
~onStartShouldSetResponderCapture: Event.pressEvent => bool=?,
94+
~pointerEvents: [@bs.string] [
95+
| `auto
96+
| `none
97+
| [@bs.as "box-none"] `boxNone
98+
| [@bs.as "box-only"] `boxOnly
99+
]
100+
=?,
101+
~removeClippedSubviews: bool=?,
102+
~renderToHardwareTextureAndroid: bool=?,
103+
~shouldRasterizeIOS: bool=?,
104+
~style: Style.t=?,
105+
~testID: string=?
106+
) =>
107+
React.element =
108+
"DatePickerIOS";
109+
110+
```
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// For localeId refer to
2+
// https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html
3+
4+
type localeId = string;
5+
6+
[@react.component] [@bs.module "react-native"]
7+
external make:
8+
(
9+
~date: Js.Date.t,
10+
~onDateChange: Js.Date.t => unit,
11+
~maximumDate: Js.Date.t=?,
12+
~minimumDate: Js.Date.t=?,
13+
~minuteInterval: [@bs.string] [
14+
| [@bs.as "1"] `_1
15+
| [@bs.as "2"] `_2
16+
| [@bs.as "3"] `_3
17+
| [@bs.as "4"] `_4
18+
| [@bs.as "5"] `_5
19+
| [@bs.as "6"] `_6
20+
| [@bs.as "10"] `_10
21+
| [@bs.as "12"] `_12
22+
| [@bs.as "15"] `_15
23+
| [@bs.as "20"] `_20
24+
| [@bs.as "30"] `_30
25+
]
26+
=?,
27+
~mode: [@bs.string] [ | `date | `time | `datetime]=?,
28+
~locale: localeId=?,
29+
~timeZoneOffsetInMinutes: int=?,
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+
"DatePickerIOS";

0 commit comments

Comments
 (0)