Skip to content

Commit

Permalink
Handle new backButtonDisplayMode functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
maciekstosio committed May 9, 2024
1 parent d0abdee commit 6dd3bd0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/native-stack/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,15 @@ export type NativeStackNavigationOptions = {
* @platform ios
*/
headerBackButtonMenuEnabled?: boolean;
/**
* How the back button behaves by default (when not customized). Available on iOS>=14.
* The following values are currently supported (they correspond to https://developer.apple.com/documentation/uikit/uinavigationitembackbuttondisplaymode?language=objc):
* - "default" – shows given back button title/previous controller title, system default or just icon based on available space
* - "generic" – shows given system default or just icon based on available space
* - "minimal" – shows just an icon
* @platform ios
*/
backButtonDisplayMode?: ScreenStackHeaderConfigProps['backButtonDisplayMode'];

Check failure on line 353 in packages/native-stack/src/types.tsx

View workflow job for this annotation

GitHub Actions / lint

Property 'backButtonDisplayMode' does not exist on type 'ScreenStackHeaderConfigProps'.
/**
* Whether the home indicator should prefer to stay hidden on this screen. Defaults to `false`.
*
Expand Down
2 changes: 2 additions & 0 deletions packages/native-stack/src/views/HeaderConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function HeaderConfig({
route,
title,
canGoBack,
backButtonDisplayMode,
}: Props): JSX.Element {
const { direction } = useLocale();
const { colors, fonts } = useTheme();
Expand Down Expand Up @@ -190,6 +191,7 @@ export function HeaderConfig({
disableBackButtonMenu={headerBackButtonMenuEnabled === false}
hidden={headerShown === false}
hideBackButton={headerBackVisible === false}
backButtonDisplayMode={backButtonDisplayMode}

Check failure on line 194 in packages/native-stack/src/views/HeaderConfig.tsx

View workflow job for this annotation

GitHub Actions / lint

Type '{ children: (Element | null)[]; backButtonInCustomView: boolean; backgroundColor: string; backTitle: string | undefined; backTitleFontFamily: string | undefined; backTitleFontSize: number | undefined; ... 21 more ...; translucent: boolean; }' is not assignable to type 'IntrinsicAttributes & ScreenStackHeaderConfigProps & { children?: ReactNode; }'.
hideShadow={
headerShadowVisible === false ||
headerBackground != null ||
Expand Down

0 comments on commit 6dd3bd0

Please sign in to comment.