From 77f29d374f7f6b4ce780d6baebeb9112451bc5c9 Mon Sep 17 00:00:00 2001 From: Tien Pham Date: Thu, 31 Oct 2019 22:30:26 +0700 Subject: [PATCH] feat: add headerBackTitleVisible to navigation options in native stack --- packages/native-stack/src/types.tsx | 7 +++++++ packages/native-stack/src/views/HeaderConfig.tsx | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/native-stack/src/types.tsx b/packages/native-stack/src/types.tsx index 72606669..b6857ed3 100644 --- a/packages/native-stack/src/types.tsx +++ b/packages/native-stack/src/types.tsx @@ -65,6 +65,13 @@ export type NativeStackNavigationOptions = { * @platform ios */ headerBackTitle?: string; + /** + * Whether the back button title should be visible or not. Defaults to `true`. + * Only supported on iOS. + * + * @platform ios + */ + headerBackTitleVisible?: boolean; /** * Whether to show the header. */ diff --git a/packages/native-stack/src/views/HeaderConfig.tsx b/packages/native-stack/src/views/HeaderConfig.tsx index 39e07c18..aba10d77 100644 --- a/packages/native-stack/src/views/HeaderConfig.tsx +++ b/packages/native-stack/src/views/HeaderConfig.tsx @@ -20,6 +20,7 @@ export default function HeaderConfig(props: Props) { headerRight, headerTitle, headerBackTitle, + headerBackTitleVisible = true, headerHideBackButton, headerHideShadow, headerTintColor, @@ -53,7 +54,7 @@ export default function HeaderConfig(props: Props) { ? headerTitleStyle.color : headerTintColor } - backTitle={headerBackTitle} + backTitle={headerBackTitleVisible ? headerBackTitle : ''} backTitleFontFamily={headerBackTitleStyle.fontFamily} backTitleFontSize={headerBackTitleStyle.fontSize} color={headerTintColor}