@@ -2,9 +2,9 @@ open ReactNative
2
2
3
3
module Header = {
4
4
type headerTitleProps = {
5
- allowFontScaling : option < bool > ,
6
- tintColor : option < Color .t > ,
7
- style : option < Style .t > ,
5
+ allowFontScaling ?: bool ,
6
+ tintColor ?: Color .t ,
7
+ style ?: Style .t ,
8
8
children : string ,
9
9
}
10
10
@@ -15,63 +15,133 @@ module Header = {
15
15
16
16
type displayMode = [#default | #generic | #minimal ]
17
17
18
- type headerLeftProps = {
19
- tintColor : option <Color .t >,
20
- pressColor : option <Color .t >,
21
- pressOpacity : option <float >,
22
- displayMode : option <displayMode >,
18
+ type headerButtonCommonProps = {
19
+ tintColor ?: Color .t ,
20
+ pressColor ?: Color .t ,
21
+ pressOpacity ?: float ,
23
22
}
24
23
25
24
type headerRightProps = {
26
- tintColor : option <Color .t >,
27
- pressColor : option <Color .t >,
28
- pressOpacity : option <float >,
25
+ ... headerButtonCommonProps ,
26
+ canGoBack ?: bool ,
27
+ }
28
+ type headerLeftProps = {
29
+ ... headerRightProps ,
30
+ displayMode ?: displayMode ,
31
+ href ?: string ,
29
32
}
30
33
31
- type headerBackgroundOptions = {style : option < Style .t > }
34
+ type headerBackgroundOptions = {style ?: Style .t }
32
35
33
36
type headerTitleAlign = [#left | #center ]
34
37
35
- @react.component @module ("@react-navigation/elements" )
36
- external make : (
37
- ~title : string = ?,
38
- ~headerTitle : headerTitle = ?,
39
- ~headerTitleAlign : headerTitleAlign = ?,
40
- ~headerTitleAllowFontScaling : bool = ?,
41
- ~headerTitleStyle : Style .t = ?,
42
- ~headerTitleContainerStyle : Style .t = ?,
43
- ~headerLeft : headerLeftProps => React .element = ?,
44
- ~headerLeftLabelVisible : bool = ?,
45
- ~headerLeftContainerStyle : Style .t = ?,
46
- ~headerRight : headerRightProps => React .element = ?,
47
- ~headerRightContainerStyle : Style .t = ?,
48
- ~headerPressColor : Color .t = ?,
49
- ~headerPressOpacity : float = ?,
50
- ~headerTintColor : Color .t = ?,
51
- ~headerBackground : headerBackgroundOptions => React .element = ?,
52
- ~headerBackgroundContainerStyle : Style .t = ?,
53
- ~headerTransparent : bool = ?,
54
- ~headerStyle : Style .t = ?,
55
- ~headerShadowVisible : bool = ?,
56
- ~headerStatusBarHeight : Style .size = ?,
57
- ) => React .element = "Header"
38
+ type inputType = [
39
+ | #text
40
+ | #phone
41
+ | #number
42
+ | #email
43
+ ]
44
+
45
+ type headerSearchBarOptions = {
46
+ ref ?: TextInputElement .ref ,
47
+ autoCapitalize ?: TextInput .autoCapitalize ,
48
+ autoFocus ?: bool ,
49
+ cancelButtonText ?: string ,
50
+ inputType ?: inputType ,
51
+ onBlur ?: Event .targetEvent => unit ,
52
+ onChangeText ?: string => unit ,
53
+ onClose ?: unit => unit ,
54
+ onFocus ?: Event .targetEvent => unit ,
55
+ placeholder ?: string ,
56
+ }
57
+
58
+ type headerOptions = {
59
+ headerTitle ?: headerTitle ,
60
+ headerTitleAlign ?: headerTitleAlign ,
61
+ headerTitleAllowFontScaling ?: bool ,
62
+ headerTitleStyle ?: Style .t ,
63
+ headerTitleContainerStyle ?: Style .t ,
64
+ headerLeft ?: headerLeftProps => React .element ,
65
+ headerLeftContainerStyle ?: Style .t ,
66
+ headerRight ?: headerRightProps => React .element ,
67
+ headerRightContainerStyle ?: Style .t ,
68
+ headerSearchBarOptions ?: headerSearchBarOptions ,
69
+ headerPressColor ?: Color .t ,
70
+ headerPressOpacity ?: float ,
71
+ headerTintColor ?: Color .t ,
72
+ headerBackground ?: headerBackgroundOptions => React .element ,
73
+ headerBackgroundContainerStyle ?: Style .t ,
74
+ headerTransparent ?: bool ,
75
+ headerStyle ?: Style .t ,
76
+ headerShadowVisible ?: bool ,
77
+ headerStatusBarHeight ?: Style .size ,
78
+ }
79
+
80
+ type backProp = {
81
+ title ?: string ,
82
+ href ?: string ,
83
+ }
84
+
85
+ type props = {
86
+ ... headerOptions ,
87
+ backProp ?: backProp ,
88
+ modal ?: bool ,
89
+ layout ?: Core .layout ,
90
+ title : string ,
91
+ }
92
+
93
+ @module ("@react-navigation/elements" )
94
+ external make : React .component <props > = "Header"
58
95
}
59
96
60
97
module HeaderBackground = {
61
- @react.component @module ("@react-navigation/elements" )
62
- external make : (
63
- // actually all RN view props
64
- ~children : React .element = ?,
65
- ) => React .element = "HeaderBackground"
98
+ @module ("@react-navigation/elements" )
99
+ external make : React .component <View .props > = "HeaderBackground"
100
+ }
101
+
102
+ module HeaderTitle = {
103
+ @module ("@react-navigation/elements" )
104
+ external make : React .component <Text .props > = "HeaderTitle"
105
+ }
106
+
107
+ module HeaderButton = {
108
+ type headerButtonProps = {
109
+ ... Header .headerButtonCommonProps ,
110
+ onPress ?: unit => unit ,
111
+ href ?: string ,
112
+ disabled ?: bool ,
113
+ accessibilityLabel ?: string ,
114
+ testID ?: string ,
115
+ style ?: Style .t ,
116
+ }
117
+
118
+ type props = {
119
+ ... headerButtonProps ,
120
+ children : React .element ,
121
+ }
122
+
123
+ @module ("@react-navigation/elements" )
124
+ external make : React .component <props > = "HeaderTitle"
66
125
}
67
126
68
127
module HeaderBackButton = {
69
- @react.component @module ("@react-navigation/elements" )
70
- external make : (
71
- ~displayMode : Header .displayMode = ?,
72
- ~tintColor : Color .t = ?,
73
- ~onPress : unit => unit ,
74
- ) => React .element = "HeaderBackButton"
128
+ type backImageProps = {tintColor ?: Color .t }
129
+
130
+ type props = {
131
+ ... HeaderButton .headerButtonProps ,
132
+ backImage ?: backImageProps => React .element ,
133
+ label ?: string ,
134
+ truncatedLabel ?: string ,
135
+ displayMode ?: Header .displayMode ,
136
+ labelStyle ?: Style .t ,
137
+ allowFontScaling ?: bool ,
138
+ onLabelLayout ?: Event .layoutEvent => unit ,
139
+ screenLayout ?: Core .layout ,
140
+ titleLayout ?: Core .layout ,
141
+ }
142
+
143
+ @module ("@react-navigation/elements" )
144
+ external make : React .component <props > = "HeaderBackButton"
75
145
}
76
146
77
147
@module ("@react-navigation/elements" )
0 commit comments