@react-navigation/native-stack 7.0.0-rc.21 → 7.0.0-rc.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/views/HeaderConfig.js +4 -2
- package/lib/commonjs/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/views/NativeStackView.native.js +1 -1
- package/lib/commonjs/views/NativeStackView.native.js.map +1 -1
- package/lib/module/views/HeaderConfig.js +4 -2
- package/lib/module/views/HeaderConfig.js.map +1 -1
- package/lib/module/views/NativeStackView.native.js +1 -1
- package/lib/module/views/NativeStackView.native.js.map +1 -1
- package/lib/typescript/commonjs/src/types.d.ts +12 -9
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/views/HeaderConfig.d.ts +1 -1
- package/lib/typescript/commonjs/src/views/HeaderConfig.d.ts.map +1 -1
- package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -1
- package/lib/typescript/module/src/types.d.ts +12 -9
- package/lib/typescript/module/src/types.d.ts.map +1 -1
- package/lib/typescript/module/src/views/HeaderConfig.d.ts +1 -1
- package/lib/typescript/module/src/views/HeaderConfig.d.ts.map +1 -1
- package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/types.tsx +12 -9
- package/src/views/HeaderConfig.tsx +14 -2
- package/src/views/NativeStackView.native.tsx +1 -1
package/src/types.tsx
CHANGED
|
@@ -148,21 +148,13 @@ export type NativeStackNavigationOptions = {
|
|
|
148
148
|
/**
|
|
149
149
|
* Title string used by the back button on iOS.
|
|
150
150
|
* Defaults to the previous scene's title, or "Back" if there's not enough space.
|
|
151
|
-
* Use `
|
|
151
|
+
* Use `headerBackButtonDisplayMode: "minimal"` to hide it.
|
|
152
152
|
*
|
|
153
153
|
* Only supported on iOS.
|
|
154
154
|
*
|
|
155
155
|
* @platform ios
|
|
156
156
|
*/
|
|
157
157
|
headerBackTitle?: string;
|
|
158
|
-
/**
|
|
159
|
-
* Whether the back button title should be visible or not.
|
|
160
|
-
*
|
|
161
|
-
* Only supported on iOS.
|
|
162
|
-
*
|
|
163
|
-
* @platform ios
|
|
164
|
-
*/
|
|
165
|
-
headerBackTitleVisible?: boolean;
|
|
166
158
|
/**
|
|
167
159
|
* Style object for header back title. Supported properties:
|
|
168
160
|
* - fontFamily
|
|
@@ -342,6 +334,17 @@ export type NativeStackNavigationOptions = {
|
|
|
342
334
|
* @platform ios
|
|
343
335
|
*/
|
|
344
336
|
headerBackButtonMenuEnabled?: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* How the back button displays icon and title.
|
|
339
|
+
*
|
|
340
|
+
* Supported values:
|
|
341
|
+
* - "default" - Displays one of the following depending on the available space: previous screen's title, generic title (e.g. 'Back') or no title (only icon).
|
|
342
|
+
* - "generic" – Displays one of the following depending on the available space: generic title (e.g. 'Back') or no title (only icon). iOS >= 14 only, falls back to "default" on older iOS versions.
|
|
343
|
+
* - "minimal" – Always displays only the icon without a title.
|
|
344
|
+
*
|
|
345
|
+
* @platform ios
|
|
346
|
+
*/
|
|
347
|
+
headerBackButtonDisplayMode?: ScreenStackHeaderConfigProps['backButtonDisplayMode'];
|
|
345
348
|
/**
|
|
346
349
|
* Whether the home indicator should prefer to stay hidden on this screen. Defaults to `false`.
|
|
347
350
|
*
|
|
@@ -24,10 +24,10 @@ type Props = NativeStackNavigationOptions & {
|
|
|
24
24
|
|
|
25
25
|
export function HeaderConfig({
|
|
26
26
|
headerBackImageSource,
|
|
27
|
+
headerBackButtonDisplayMode,
|
|
27
28
|
headerBackButtonMenuEnabled,
|
|
28
29
|
headerBackTitle,
|
|
29
30
|
headerBackTitleStyle,
|
|
30
|
-
headerBackTitleVisible = true,
|
|
31
31
|
headerBackVisible,
|
|
32
32
|
headerShadowVisible,
|
|
33
33
|
headerLargeStyle,
|
|
@@ -176,12 +176,24 @@ export function HeaderConfig({
|
|
|
176
176
|
Platform.OS === 'ios' &&
|
|
177
177
|
headerTransparent !== false);
|
|
178
178
|
|
|
179
|
+
const isBackButtonDisplayModeAvailableForCurrentPlatform =
|
|
180
|
+
Platform.OS === 'ios' && parseInt(Platform.Version, 10) >= 14;
|
|
181
|
+
|
|
179
182
|
return (
|
|
180
183
|
<ScreenStackHeaderConfig
|
|
181
184
|
backButtonInCustomView={backButtonInCustomView}
|
|
182
185
|
backgroundColor={headerBackgroundColor}
|
|
183
186
|
backTitle={headerBackTitle}
|
|
184
|
-
backTitleVisible={
|
|
187
|
+
backTitleVisible={
|
|
188
|
+
isBackButtonDisplayModeAvailableForCurrentPlatform
|
|
189
|
+
? undefined
|
|
190
|
+
: headerBackButtonDisplayMode !== 'minimal'
|
|
191
|
+
}
|
|
192
|
+
backButtonDisplayMode={
|
|
193
|
+
isBackButtonDisplayModeAvailableForCurrentPlatform
|
|
194
|
+
? headerBackButtonDisplayMode
|
|
195
|
+
: undefined
|
|
196
|
+
}
|
|
185
197
|
backTitleFontFamily={backTitleFontFamily}
|
|
186
198
|
backTitleFontSize={backTitleFontSize}
|
|
187
199
|
blurEffect={headerBlurEffect}
|
|
@@ -343,6 +343,7 @@ const SceneView = ({
|
|
|
343
343
|
homeIndicatorHidden={autoHideHomeIndicator}
|
|
344
344
|
hideKeyboardOnSwipe={keyboardHandlingEnabled}
|
|
345
345
|
navigationBarColor={navigationBarColor}
|
|
346
|
+
navigationBarTranslucent={navigationBarTranslucent}
|
|
346
347
|
navigationBarHidden={navigationBarHidden}
|
|
347
348
|
replaceAnimation={animationTypeForReplace}
|
|
348
349
|
stackPresentation={presentation === 'card' ? 'push' : presentation}
|
|
@@ -425,7 +426,6 @@ const SceneView = ({
|
|
|
425
426
|
// So we keep any props that need it at the end
|
|
426
427
|
// Otherwise invalid props may not be caught by TypeScript
|
|
427
428
|
// @ts-expect-error Props available in newer versions of `react-native-screens`
|
|
428
|
-
navigationBarTranslucent={navigationBarTranslucent}
|
|
429
429
|
fullScreenSwipeShadowEnabled={fullScreenGestureShadowEnabled} // 3.33.0 onwards
|
|
430
430
|
>
|
|
431
431
|
<NavigationContext.Provider value={navigation}>
|