Skip to content

Commit 2b69eda

Browse files
committed
use header options on stack and native-stack
1 parent 33601ed commit 2b69eda

File tree

3 files changed

+15
-37
lines changed

3 files changed

+15
-37
lines changed

Diff for: src/Elements.res

+12-8
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,29 @@ module Header = {
5555
placeholder?: string,
5656
}
5757

58-
type headerOptions = {
58+
type headerCommonOptions = {
5959
headerTitle?: headerTitle,
6060
headerTitleAlign?: headerTitleAlign,
61-
headerTitleAllowFontScaling?: bool,
61+
headerLeft?: headerLeftProps => React.element,
62+
headerRight?: headerRightProps => React.element,
63+
headerTintColor?: Color.t,
64+
headerBackground?: headerBackgroundOptions => React.element,
65+
headerTransparent?: bool,
66+
headerShadowVisible?: bool,
67+
}
68+
69+
type headerOptions = {
70+
...headerCommonOptions,
6271
headerTitleStyle?: Style.t,
72+
headerTitleAllowFontScaling?: bool,
6373
headerTitleContainerStyle?: Style.t,
64-
headerLeft?: headerLeftProps => React.element,
6574
headerLeftContainerStyle?: Style.t,
66-
headerRight?: headerRightProps => React.element,
6775
headerRightContainerStyle?: Style.t,
6876
headerSearchBarOptions?: headerSearchBarOptions,
6977
headerPressColor?: Color.t,
7078
headerPressOpacity?: float,
71-
headerTintColor?: Color.t,
72-
headerBackground?: headerBackgroundOptions => React.element,
7379
headerBackgroundContainerStyle?: Style.t,
74-
headerTransparent?: bool,
7580
headerStyle?: Style.t,
76-
headerShadowVisible?: bool,
7781
headerStatusBarHeight?: Style.size,
7882
}
7983

Diff for: src/NativeStack.res

+2-9
Original file line numberDiff line numberDiff line change
@@ -125,28 +125,21 @@ type backOptions = {title?: string}
125125
type gestureDirection = [#vertical | #horizontal]
126126

127127
type rec options = {
128+
...Header.headerCommonOptions,
128129
title?: string,
129130
headerBackButtonMenuEnabled?: bool,
130131
headerBackVisible?: bool,
131132
headerBackTitle?: string,
132133
headerBackButtonDisplayMode?: Stack.headerBackButtonDisplayMode,
133134
headerBackTitleStyle?: headerBackTitleStyle,
134-
headerBackImageSource?: string, // TODO
135+
headerBackImageSource?: Image.Source.t,
135136
headerLargeStyle?: headerLargeStyle,
136137
headerLargeTitle?: bool,
137138
headerLargeTitleShadowVisible?: bool,
138139
headerLargeTitleStyle?: headerLargeTitleStyle,
139140
headerShown?: bool,
140141
headerStyle?: headerStyle,
141-
headerShadowVisible?: bool,
142-
headerTransparent?: bool,
143142
headerBlurEffect?: blurEffect,
144-
headerBackground?: Header.headerBackgroundOptions => React.element,
145-
headerTintColor?: Color.t,
146-
headerLeft?: Header.headerLeftProps => React.element,
147-
headerRight?: Header.headerRightProps => React.element,
148-
headerTitle?: Header.headerTitle,
149-
headerTitleAlign?: headerTitleAlign,
150143
headerTitleStyle?: headerTitleStyle,
151144
headerSearchBarOptions?: headerSearchBarOptions,
152145
header?: headerParams => React.element,

Diff for: src/Stack.res

+1-20
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ type progress = {
115115
}
116116

117117
type rec options = {
118+
...Header.headerOptions,
118119
title?: string,
119120
cardShadowEnabled?: bool,
120121
cardOverlayEnabled?: bool,
@@ -143,26 +144,6 @@ type rec options = {
143144
headerBackButtonDisplayMode?: headerBackButtonDisplayMode,
144145
headerBackTruncatedTitle?: string,
145146
headerBackTitleStyle?: Style.t,
146-
// Header props from https://reactnavigation.org/docs/elements#header
147-
headerTitle?: Header.headerTitle,
148-
headerTitleAlign?: Header.headerTitleAlign,
149-
headerTitleAllowFontScaling?: bool,
150-
headerTitleStyle?: Style.t,
151-
headerTitleContainerStyle?: Style.t,
152-
headerLeft?: Header.headerLeftProps => React.element,
153-
headerLeftLabelVisible?: bool,
154-
headerLeftContainerStyle?: Style.t,
155-
headerRight?: Header.headerRightProps => React.element,
156-
headerRightContainerStyle?: Style.t,
157-
headerPressColor?: Color.t,
158-
headerPressOpacity?: float,
159-
headerTintColor?: Color.t,
160-
headerBackground?: Header.headerBackgroundOptions => React.element,
161-
headerBackgroundContainerStyle?: Style.t,
162-
headerTransparent?: bool,
163-
headerStyle?: Style.t,
164-
headerShadowVisible?: bool,
165-
headerStatusBarHeight?: Style.size,
166147
}
167148
and headerParams = {
168149
navigation: navigation,

0 commit comments

Comments
 (0)