From 144ddf2733398578c425e916ac42939c71d513cb Mon Sep 17 00:00:00 2001 From: tboba Date: Mon, 8 Jan 2024 17:25:02 +0100 Subject: [PATCH] Add ability to change header type during fast-refresh/live, moar examples --- FabricTestExample/src/Test1874.tsx | 13 ++++++++++++- TestsExample/src/Test1874.tsx | 13 ++++++++++++- .../src/main/java/com/swmansion/rnscreens/Screen.kt | 7 ++++++- .../com/swmansion/rnscreens/ScreenStackHeader.kt | 5 +++++ .../swmansion/rnscreens/ScreenStackHeaderConfig.kt | 6 ++++++ 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/FabricTestExample/src/Test1874.tsx b/FabricTestExample/src/Test1874.tsx index d1b91811fa..3785668fac 100644 --- a/FabricTestExample/src/Test1874.tsx +++ b/FabricTestExample/src/Test1874.tsx @@ -111,6 +111,10 @@ function useHeaderOptions( } function SettingsSwitcher({ navigation }: SettingsScreenProps) { + const { currentValue: headerType, component: headerTypeSetting } = + useHeaderOptions('header type', 'large', ['large', 'medium', 'small']); + const { currentValue: headerTitleAlign, component: headerTitleAlignSetting } = + useHeaderOptions('title align', 'left', ['left', 'center']); const { currentValue: backgroundColor, component: bgColorSetting } = useHeaderOptions('background color', 'white', [ 'white', @@ -138,21 +142,27 @@ function SettingsSwitcher({ navigation }: SettingsScreenProps) { navigation.setOptions({ headerStyle: { backgroundColor }, headerTitleStyle: { color: textColor }, + headerTitleAlign, headerHideShadow: hideShadow, headerShown, headerTranslucent, + headerType, }); }, [ navigation, + headerType, backgroundColor, textColor, hideShadow, headerShown, headerTranslucent, + headerTitleAlign, ]); return ( + {headerTypeSetting} + {headerTitleAlignSetting} {bgColorSetting} {textColorSetting} {hideShadowSetting} @@ -274,7 +284,8 @@ export default function App() { name="Settings" component={Settings} options={{ - headerType: 'large', + headerTitle: 'Settings', + headerType: 'medium', }} /> + {headerTypeSetting} + {headerTitleAlignSetting} {bgColorSetting} {textColorSetting} {hideShadowSetting} @@ -274,7 +284,8 @@ export default function App() { name="Settings" component={Settings} options={{ - headerType: 'large', + headerTitle: 'Settings', + headerType: 'medium', }} />