@react-navigation/native-stack 7.0.0-rc.22 → 7.0.0-rc.23

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/native-stack",
3
3
  "description": "Native stack navigator using react-native-screens",
4
- "version": "7.0.0-rc.22",
4
+ "version": "7.0.0-rc.23",
5
5
  "keywords": [
6
6
  "react-native-component",
7
7
  "react-component",
@@ -52,12 +52,12 @@
52
52
  "clean": "del lib"
53
53
  },
54
54
  "dependencies": {
55
- "@react-navigation/elements": "^2.0.0-rc.19",
55
+ "@react-navigation/elements": "^2.0.0-rc.20",
56
56
  "warn-once": "^0.1.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@jest/globals": "^29.7.0",
60
- "@react-navigation/native": "^7.0.0-rc.17",
60
+ "@react-navigation/native": "^7.0.0-rc.18",
61
61
  "@testing-library/react-native": "^12.4.3",
62
62
  "@types/react": "~18.2.79",
63
63
  "del-cli": "^5.1.0",
@@ -68,7 +68,7 @@
68
68
  "typescript": "^5.5.2"
69
69
  },
70
70
  "peerDependencies": {
71
- "@react-navigation/native": "^7.0.0-rc.17",
71
+ "@react-navigation/native": "^7.0.0-rc.18",
72
72
  "react": ">= 18.2.0",
73
73
  "react-native": ">= 0.72.0",
74
74
  "react-native-safe-area-context": ">= 4.0.0",
@@ -99,5 +99,5 @@
99
99
  ]
100
100
  ]
101
101
  },
102
- "gitHead": "1a26dd67e4b9625075e6e5229736d1c679c67ccb"
102
+ "gitHead": "b32550a43d0e2b532cfe100d9cf17837184a636e"
103
103
  }
package/src/types.tsx CHANGED
@@ -339,9 +339,17 @@ export type NativeStackNavigationOptions = {
339
339
  *
340
340
  * Supported values:
341
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.
342
+ * - "generic" – Displays one of the following depending on the available space: generic title (e.g. 'Back') or no title (only icon).
343
343
  * - "minimal" – Always displays only the icon without a title.
344
344
  *
345
+ * The "generic" mode is not supported when:
346
+ * - The iOS version is lower than 14
347
+ * - Custom back title is set
348
+ * - Custom back title style is set
349
+ * - Back button menu is disabled
350
+ *
351
+ * In such cases, the "default" mode will be used instead.
352
+ *
345
353
  * @platform ios
346
354
  */
347
355
  headerBackButtonDisplayMode?: ScreenStackHeaderConfigProps['backButtonDisplayMode'];
@@ -176,8 +176,17 @@ 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;
179
+ const isBackButtonDisplayModeAvailable =
180
+ // On iOS 14+
181
+ Platform.OS === 'ios' &&
182
+ parseInt(Platform.Version, 10) >= 14 &&
183
+ // Doesn't have custom back title
184
+ headerBackTitle == null &&
185
+ // Doesn't have custom styling
186
+ backTitleFontFamily == null &&
187
+ backTitleFontSize == null &&
188
+ // Back button menu is not disabled
189
+ headerBackButtonMenuEnabled !== false;
181
190
 
182
191
  return (
183
192
  <ScreenStackHeaderConfig
@@ -185,12 +194,12 @@ export function HeaderConfig({
185
194
  backgroundColor={headerBackgroundColor}
186
195
  backTitle={headerBackTitle}
187
196
  backTitleVisible={
188
- isBackButtonDisplayModeAvailableForCurrentPlatform
197
+ isBackButtonDisplayModeAvailable
189
198
  ? undefined
190
199
  : headerBackButtonDisplayMode !== 'minimal'
191
200
  }
192
201
  backButtonDisplayMode={
193
- isBackButtonDisplayModeAvailableForCurrentPlatform
202
+ isBackButtonDisplayModeAvailable
194
203
  ? headerBackButtonDisplayMode
195
204
  : undefined
196
205
  }