You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/configuring-links.md
+94Lines changed: 94 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -758,6 +758,100 @@ const state = {
758
758
759
759
</details>
760
760
761
+
## Matching multiple path segments
762
+
763
+
A path param normally matches one path segment. For example, the path `user/:id` will match `/user/jane` but not `/user/jane/settings`.
764
+
765
+
If you want to match multiple segments, you can add `+` or `*` suffix after the param name.
766
+
767
+
-`+` matches one or more segments. For example, `files/:parts+` will match `/files/a` and `/files/a/b`.
768
+
-`*` matches zero or more segments. For example, `files/:parts*` will match `/files`, `/files/a` and `/files/a/b`.
769
+
770
+
<ConfigTabs>
771
+
<TabItemvalue="static">
772
+
773
+
```js
774
+
constRootStack=createStackNavigator({
775
+
screens: {
776
+
Files: {
777
+
screen: FilesScreen,
778
+
// Matches /files/a and /files/a/b
779
+
linking:'files/:parts+',
780
+
},
781
+
OptionalFiles: {
782
+
screen: OptionalFilesScreen,
783
+
// Also matches /optional-files
784
+
linking:'optional-files/:parts*',
785
+
},
786
+
},
787
+
});
788
+
```
789
+
790
+
</TabItem>
791
+
<TabItemvalue="dynamic">
792
+
793
+
```js
794
+
constconfig= {
795
+
screens: {
796
+
// Matches /files/a and /files/a/b
797
+
Files:'files/:parts+',
798
+
// Also matches /optional-files
799
+
OptionalFiles:'optional-files/:parts*',
800
+
},
801
+
};
802
+
```
803
+
804
+
</TabItem>
805
+
</ConfigTabs>
806
+
807
+
When using `+` or `*`, the route params will contain a string with the matched segment, e.g. for `/files/a/b`, the `parts` param will be `a/b`. It can be an empty string if the param is optional and not present in the URL.
808
+
809
+
If you want to get the segments as an array, you can use a custom `parse`[function](#using-functions) or [schema](#using-standard-schema):
810
+
811
+
<ConfigTabs>
812
+
<TabItemvalue="static">
813
+
814
+
```js
815
+
constRootStack=createStackNavigator({
816
+
screens: {
817
+
Files: {
818
+
screen: FilesScreen,
819
+
linking: {
820
+
path:'files/:parts+',
821
+
parse: {
822
+
parts: (parts) =>parts.split('/'),
823
+
},
824
+
stringify: {
825
+
parts: (parts) =>parts.join('/'),
826
+
},
827
+
},
828
+
},
829
+
},
830
+
});
831
+
```
832
+
833
+
</TabItem>
834
+
<TabItemvalue="dynamic">
835
+
836
+
```js
837
+
constconfig= {
838
+
screens: {
839
+
Files: {
840
+
path:'files/:parts+',
841
+
parse: {
842
+
parts: (parts) =>parts.split('/'),
843
+
},
844
+
stringify: {
845
+
parts: (parts) =>parts.join('/'),
846
+
},
847
+
},
848
+
},
849
+
};
850
+
```
851
+
852
+
</TabItem>
853
+
</ConfigTabs>
854
+
761
855
## Handling unmatched routes or 404
762
856
763
857
If your app is opened with an invalid URL, most of the times you'd want to show an error page with some information. On the web, this is commonly known as 404 - or page not found error.
Plain style object for the symbol's native view. If you need to pass a style array, use `StyleSheet.flatten` to convert it to a plain style object.
343
+
340
344
## Material Symbols
341
345
342
346
Material Symbols is a library of over 2,500 glyphs designed to integrate well with Material Design on Android.
@@ -451,6 +455,10 @@ The component accepts the following props:
451
455
452
456
The available weights depend on which weights are included in the bundle. If the specified weight is not included, it will throw an error.
453
457
458
+
-`style`
459
+
460
+
Plain style object for the symbol's native view. If you need to pass a style array, use `StyleSheet.flatten` to convert it to a plain style object.
461
+
454
462
## Images
455
463
456
464
React Navigation also supports using images as icons. It supports the same formats as React Native's [`Image`](https://reactnative.dev/docs/image) component.
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/navigation-container.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -180,7 +180,7 @@ See the [Navigation ref](navigation-ref.md) guide for more details.
180
180
181
181
### Methods on the ref
182
182
183
-
The ref object includes all of the common navigation methods such as `navigate`, `goBack` etc. See [docs for `CommonActions`](navigation-actions.md) for more details.
183
+
The ref object includes common navigation methods such as `navigate`, `goBack` etc. See [docs for `CommonActions`](navigation-actions.md) for more details.
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/stack-navigator.md
+57-9Lines changed: 57 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -172,11 +172,15 @@ String that can be used as a fallback for `headerTitle`.
172
172
173
173
#### `cardShadowEnabled`
174
174
175
-
Use this prop to have visible shadows during transitions. Defaults to `true`.
175
+
Whether to show a shadow during transitions. By default, the shadow is shown when the selected `cardStyleInterpolator` provides a `shadowStyle`.
176
+
177
+
Set it to `true` to always render the shadow or `false` to disable the shadow.
176
178
177
179
#### `cardOverlayEnabled`
178
180
179
-
Use this prop to have a semi-transparent dark overlay visible under the card during transitions. Defaults to `true` on Android and `false` on iOS.
181
+
Whether to show a semi-transparent dark overlay under the card during transitions. By default, the overlay is shown when the selected `cardStyleInterpolator` provides an `overlayStyle`.
182
+
183
+
Set it to `true` to always render the overlay or `false` to disable the overlay.
180
184
181
185
#### `cardOverlay`
182
186
@@ -219,7 +223,7 @@ When `pop` is used, the `pop` animation is applied to the screen being replaced.
219
223
220
224
#### `gestureEnabled`
221
225
222
-
Whether you can use gestures to dismiss this screen. Defaults to `true` on iOS, `false`on Android.
226
+
Whether you can use gestures to dismiss this screen. It defaults to `true` on iOS for navigation-style transitions that support interactive dismissal, and `false`otherwise.
223
227
224
228
Gestures are not supported on Web.
225
229
@@ -279,7 +283,8 @@ This accepts a function that returns a React Element to display as a header. The
279
283
-`navigation` - The navigation object for the current screen.
280
284
-`route` - The route object for the current screen.
281
285
-`options` - The options for the current screen
282
-
-`progress` Animated nodes representing the progress of the animation.
286
+
-`progress` - Animated nodes representing the progress of the animation.
287
+
-`inverted` - Direction multiplier for the transition. `-1` when inverted, `1` otherwise.
283
288
-`back` - Options for the back button, contains an object with a `title` property to use for back button label.
284
289
-`styleInterpolator` - Function which returns interpolated styles for various elements in the header.
285
290
@@ -628,9 +633,10 @@ This hook returns values related to the screen's animation. It contains the foll
628
633
629
634
-`current` - Values for the current screen:
630
635
-`progress` - Animated node representing the progress value of the current screen.
636
+
-`closing` - Animated node representing whether the current screen is using the closing or opening animation. `1` when closing, `0` when opening.
631
637
-`next` - Values for the screen after this one in the stack. This can be `undefined` in case the screen animating is the last one.
632
638
-`progress` - Animated node representing the progress value of the next screen.
633
-
-`closing` - Animated node representing whether the card is closing. `1` when closing, `0`if not.
639
+
-`closing` - Animated node representing whether the next screen is using the closing or opening animation. `1` when closing, `0`when opening.
634
640
-`swiping` - Animated node representing whether the card is being swiped. `1` when swiping, `0` if not.
635
641
-`inverted` - Animated node representing whether the card is inverted. `-1` when inverted, `1` if not.
636
642
-`index` - The index of the card in the stack.
@@ -684,6 +690,10 @@ Supported values for `animation` are:
684
690
685
691
Standard Android-style fade-in from the right for Android 14.
@@ -857,12 +875,16 @@ Stack Navigator exposes various options to configure the transition animation wh
857
875
The function receives the following properties in its argument:
858
876
-`current` - Values for the current screen:
859
877
-`progress` - Animated node representing the progress value of the current screen.
878
+
-`closing` - Animated node representing whether the current screen is using the closing or opening animation. `1` when closing, `0` when opening.
860
879
-`next` - Values for the screen after this one in the stack. This can be `undefined` in case the screen animating is the last one.
861
880
-`progress` - Animated node representing the progress value of the next screen.
881
+
-`closing` - Animated node representing whether the next screen is using the closing or opening animation. `1` when closing, `0` when opening.
862
882
-`index` - The index of the card in the stack.
863
-
-`closing` - Animated node representing whether the card is closing. `1` when closing, `0` if not.
883
+
-`swiping` - Animated node representing whether the card is being swiped. `1` when swiping, `0` otherwise.
884
+
-`inverted` - Animated node representing the transition direction. `-1` when inverted, `1` otherwise.
864
885
-`layouts` - Layout measurements for various items we use for animation.
865
886
-`screen` - Layout of the whole screen. Contains `height` and `width` properties.
887
+
-`insets` - Safe area insets. Contains `top`, `right`, `bottom`, and `left` properties.
866
888
867
889
> **Note that when a screen is not the last, it will use the next screen's transition config.** This is because many transitions involve an animation of the previous screen, and so these two transitions need to be kept together to prevent running two different kinds of transitions on the two screens (for example a slide and a modal). You can check the `next` parameter to find out if you want to animate out the previous screen. For more information about this parameter, see [Animation](stack-navigator.md#animations) section.
-`progress` - Animated node representing the progress value of the current screen. `0` when screen should start coming into view, `0.5` when it's mid-way, `1` when it should be fully in view.
1021
1043
-`next` - Values for the screen after this one in the stack. This can be `undefined` in case the screen animating is the last one.
1022
1044
-`progress` - Animated node representing the progress value of the next screen.
1045
+
-`inverted` - Direction multiplier for the transition. `-1` when inverted, `1` otherwise.
1023
1046
-`layouts` - Layout measurements for the screen. Each layout object contain `height` and `width` properties.
1024
1047
-`screen` - Layout of the whole screen.
1025
1048
@@ -1126,9 +1149,16 @@ With these options, it's possible to build custom transition animations for scre
1126
1149
#### `TransitionSpecs`
1127
1150
1128
1151
-`TransitionIOSSpec` - Exact values from UINavigationController's animation configuration.
1152
+
-`FlipIOSSpec` - Configuration for the iOS horizontal flip transition.
1129
1153
-`FadeInFromBottomAndroidSpec` - Configuration for activity open animation from Android Nougat.
1130
1154
-`FadeOutToBottomAndroidSpec` - Configuration for activity close animation from Android Nougat.
1131
-
-`RevealFromBottomAndroidSpec` - Approximate configuration for activity open animation from Android Pie.
1155
+
-`DialogAndroidSpec` - Configuration for the standard Android dialog transition.
1156
+
-`RevealFromBottomAndroidSpec` - Configuration for activity open animation from Android Pie.
1157
+
-`ScaleFromCenterAndroidSpec` - Configuration for activity open animation from Android 10.
1158
+
-`FadeInFromRightAndroidSpec` - Configuration for activity open animation from Android 14 and later.
1159
+
-`FadeOutToRightAndroidSpec` - Configuration for activity close animation from Android 14 and later.
1160
+
-`BottomSheetSlideInSpec` - Configuration for the Material 3 bottom sheet opening animation.
1161
+
-`BottomSheetSlideOutSpec` - Configuration for the Material 3 bottom sheet closing animation.
1132
1162
1133
1163
Example:
1134
1164
@@ -1181,6 +1211,14 @@ import { TransitionSpecs } from '@react-navigation/stack';
1181
1211
-`forModalPresentationIOS` - Standard iOS-style modal animation.
1182
1212
-`forFadeFromBottomAndroid` - Standard Android-style fade in from the bottom for Android Oreo.
1183
1213
-`forRevealFromBottomAndroid` - Standard Android-style reveal from the bottom for Android Pie.
1214
+
-`forScaleFromCenterAndroid` - Standard Android-style scale from the center for Android 10.
1215
+
-`forFadeFromRightAndroid` - Standard Android-style fade from the right for Android 14 and later.
1216
+
-`forBottomSheetAndroid` - Standard Material 3 bottom sheet animation.
1217
+
-`forDialogAndroid` - Standard Android dialog animation.
1218
+
-`forFadeFromCenter` - Simple fade animation.
1219
+
-`forCrossDissolveIOS` - Standard iOS cross-dissolve animation.
1220
+
-`forFlipIOS` - Standard iOS horizontal flip animation.
1221
+
-`forNoAnimation` - No card animation.
1184
1222
1185
1223
Example configuration for Android Oreo style vertical screen fade animation:
1186
1224
@@ -1249,7 +1287,10 @@ export default function App() {
1249
1287
1250
1288
-`forUIKit` - Standard UIKit style animation for the header where the title fades into the back button label.
1251
1289
-`forFade` - Simple fade animation for the header elements.
1252
-
-`forStatic` - Simple translate animation to translate the header along with the sliding screen.
1290
+
-`forSlideLeft` - Simple animation that translates the header to the left.
1291
+
-`forSlideRight` - Simple animation that translates the header to the right.
1292
+
-`forSlideUp` - Simple animation that translates the header up.
1293
+
-`forNoAnimation` - No header animation.
1253
1294
1254
1295
Example configuration for default iOS animation for header elements where the title fades into the back button:
1255
1296
@@ -1328,8 +1369,15 @@ We export various transition presets which bundle various set of these options t
1328
1369
-`ModalSlideFromBottomIOS` - Standard iOS navigation transition for modals.
1329
1370
-`ModalPresentationIOS` - Standard iOS modal presentation style (introduced in iOS 13).
1330
1371
-`FadeFromBottomAndroid` - Standard Android navigation transition when opening or closing an Activity on Android < 9 (Oreo).
1372
+
-`DialogAndroid` - Standard Android dialog transition.
1331
1373
-`RevealFromBottomAndroid` - Standard Android navigation transition when opening or closing an Activity on Android 9 (Pie).
1332
1374
-`ScaleFromCenterAndroid` - Standard Android navigation transition when opening or closing an Activity on Android >= 10.
1375
+
-`FadeFromRightAndroid` - Standard Android navigation transition when opening or closing an Activity on Android 14 and later.
1376
+
-`BottomSheetAndroid` - Standard Material 3 bottom sheet transition.
1377
+
-`ModalFadeTransition` - Fade transition for transparent modals.
1378
+
-`ModalFlipIOS` - Standard iOS horizontal flip transition.
1379
+
-`CrossDissolveIOS` - Standard iOS cross-dissolve transition.
1380
+
-`SlideFromLeftIOS` - Standard iOS navigation transition from the left.
1333
1381
-`DefaultTransition` - Default navigation transition for the current platform.
1334
1382
-`ModalTransition` - Default modal transition for the current platform.
0 commit comments