Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iOS): Handle new backButtonDisplayMode functionality #11980

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@
* @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 @@
route,
title,
canGoBack,
backButtonDisplayMode,
}: Props): JSX.Element {
const { direction } = useLocale();
const { colors, fonts } = useTheme();
Expand Down Expand Up @@ -190,6 +191,7 @@
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