Skip to content

Commit

Permalink
use header options on stack and native-stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Freddy03h committed Jan 15, 2025
1 parent 33601ed commit 2b69eda
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 37 deletions.
20 changes: 12 additions & 8 deletions src/Elements.res
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,29 @@ module Header = {
placeholder?: string,
}

type headerOptions = {
type headerCommonOptions = {
headerTitle?: headerTitle,
headerTitleAlign?: headerTitleAlign,
headerTitleAllowFontScaling?: bool,
headerLeft?: headerLeftProps => React.element,
headerRight?: headerRightProps => React.element,
headerTintColor?: Color.t,
headerBackground?: headerBackgroundOptions => React.element,
headerTransparent?: bool,
headerShadowVisible?: bool,
}

type headerOptions = {
...headerCommonOptions,
headerTitleStyle?: Style.t,
headerTitleAllowFontScaling?: bool,
headerTitleContainerStyle?: Style.t,
headerLeft?: headerLeftProps => React.element,
headerLeftContainerStyle?: Style.t,
headerRight?: headerRightProps => React.element,
headerRightContainerStyle?: Style.t,
headerSearchBarOptions?: headerSearchBarOptions,
headerPressColor?: Color.t,
headerPressOpacity?: float,
headerTintColor?: Color.t,
headerBackground?: headerBackgroundOptions => React.element,
headerBackgroundContainerStyle?: Style.t,
headerTransparent?: bool,
headerStyle?: Style.t,
headerShadowVisible?: bool,
headerStatusBarHeight?: Style.size,
}

Expand Down
11 changes: 2 additions & 9 deletions src/NativeStack.res
Original file line number Diff line number Diff line change
Expand Up @@ -125,28 +125,21 @@ type backOptions = {title?: string}
type gestureDirection = [#vertical | #horizontal]

type rec options = {
...Header.headerCommonOptions,
title?: string,
headerBackButtonMenuEnabled?: bool,
headerBackVisible?: bool,
headerBackTitle?: string,
headerBackButtonDisplayMode?: Stack.headerBackButtonDisplayMode,
headerBackTitleStyle?: headerBackTitleStyle,
headerBackImageSource?: string, // TODO
headerBackImageSource?: Image.Source.t,
headerLargeStyle?: headerLargeStyle,
headerLargeTitle?: bool,
headerLargeTitleShadowVisible?: bool,
headerLargeTitleStyle?: headerLargeTitleStyle,
headerShown?: bool,
headerStyle?: headerStyle,
headerShadowVisible?: bool,
headerTransparent?: bool,
headerBlurEffect?: blurEffect,
headerBackground?: Header.headerBackgroundOptions => React.element,
headerTintColor?: Color.t,
headerLeft?: Header.headerLeftProps => React.element,
headerRight?: Header.headerRightProps => React.element,
headerTitle?: Header.headerTitle,
headerTitleAlign?: headerTitleAlign,
headerTitleStyle?: headerTitleStyle,
headerSearchBarOptions?: headerSearchBarOptions,
header?: headerParams => React.element,
Expand Down
21 changes: 1 addition & 20 deletions src/Stack.res
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ type progress = {
}

type rec options = {
...Header.headerOptions,
title?: string,
cardShadowEnabled?: bool,
cardOverlayEnabled?: bool,
Expand Down Expand Up @@ -143,26 +144,6 @@ type rec options = {
headerBackButtonDisplayMode?: headerBackButtonDisplayMode,
headerBackTruncatedTitle?: string,
headerBackTitleStyle?: Style.t,
// Header props from https://reactnavigation.org/docs/elements#header
headerTitle?: Header.headerTitle,
headerTitleAlign?: Header.headerTitleAlign,
headerTitleAllowFontScaling?: bool,
headerTitleStyle?: Style.t,
headerTitleContainerStyle?: Style.t,
headerLeft?: Header.headerLeftProps => React.element,
headerLeftLabelVisible?: bool,
headerLeftContainerStyle?: Style.t,
headerRight?: Header.headerRightProps => React.element,
headerRightContainerStyle?: Style.t,
headerPressColor?: Color.t,
headerPressOpacity?: float,
headerTintColor?: Color.t,
headerBackground?: Header.headerBackgroundOptions => React.element,
headerBackgroundContainerStyle?: Style.t,
headerTransparent?: bool,
headerStyle?: Style.t,
headerShadowVisible?: bool,
headerStatusBarHeight?: Style.size,
}
and headerParams = {
navigation: navigation,
Expand Down

0 comments on commit 2b69eda

Please sign in to comment.