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-6.x/configuring-links.md
+15
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,21 @@ const linking = {
69
69
};
70
70
```
71
71
72
+
### Filtering certain paths
73
+
74
+
Sometimes we may not want to handle all incoming links. For example, we may want to filter out links meant for authentication (e.g. `expo-auth-session`) or other purposes instead of navigating to a specific screen.
This is not supported on Web as we always need to handle the URL of the page.
86
+
72
87
## Mapping path to route names
73
88
74
89
To handle a link, you need to translate it to a valid [navigation state](navigation-state.md) and vice versa. For example, the path `/rooms/chat?user=jane` may be translated to a state object like this:
On iOS 13+ and Android 10+, you can get user's preferred color scheme (`'dark'` or `'light'`) with the ([Appearance API](https://reactnative.dev/docs/appearance)).
82
+
On iOS 13+ and Android 10+, you can get user's preferred color scheme (`'dark'` or `'light'`) with the ([`useColorScheme` hook](https://reactnative.dev/docs/usecolorscheme)).
@@ -319,10 +319,6 @@ Style for the badge on the tab icon. You can specify a background color or text
319
319
320
320
Accessibility label for the tab button. This is read by the screen reader when the user taps the tab. It's recommended to set this if you don't have a label for the tab.
321
321
322
-
#### `tabBarTestID`
323
-
324
-
ID to locate this tab button in tests.
325
-
326
322
#### `tabBarButton`
327
323
328
324
Function which returns a React element to render as the tab bar button. It wraps the icon and label. Renders `Pressable` by default.
@@ -333,6 +329,10 @@ You can specify a custom implementation here:
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/configuring-links.md
+34
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,40 @@ const linking = {
69
69
};
70
70
```
71
71
72
+
### Filtering certain paths
73
+
74
+
Sometimes we may not want to handle all incoming links. For example, we may want to filter out links meant for authentication (e.g. `expo-auth-session`) or other purposes instead of navigating to a specific screen.
This is not supported on Web as we always need to handle the URL of the page.
87
+
88
+
### Apps under subpaths
89
+
90
+
If your app is hosted under a subpath, you can specify the subpath at the top-level of the `config`. For example, if your app is hosted at `https://mychat.com/app`, you can specify the `path` as `app`:
91
+
92
+
```js
93
+
constlinking= {
94
+
prefixes: ['mychat://', 'https://mychat.com'],
95
+
config: {
96
+
// highlight-next-line
97
+
path:'app',
98
+
99
+
// ...
100
+
},
101
+
};
102
+
```
103
+
104
+
It's not possible to specify params here since this doesn't belong to a screen, e.g. `app/:id` won't work.
105
+
72
106
## Mapping path to route names
73
107
74
108
To handle a link, you need to translate it to a valid [navigation state](navigation-state.md) and vice versa. For example, the path `/rooms/chat?user=jane` may be translated to a state object like this:
Now, we can customize it to add additional functionality or change the behavior. For example, use a [custom router](custom-routers.md) instead of the default `TabRouter`:
Then, you need to install and configure the libraries that are required by the drawer:
24
24
25
-
1. First, install [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/).
25
+
1. First, install [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/) (at least version 2 or 3).
26
26
27
27
If you have a Expo managed project, in your project directory, run:
28
28
@@ -36,9 +36,9 @@ Then, you need to install and configure the libraries that are required by the d
The Drawer supports both Reanimated 1 and the latest version of Reanimated. If you want to use the latest version of Reanimated, make sure to configure it following the [installation guide](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started).
39
+
2. Configure the Reanimated Babel Plugin in your project following the [installation guide](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started).
40
40
41
-
2. To finalize installation of `react-native-gesture-handler`, add the following at the **top** (make sure it's at the top and there's nothing else before it) of your entry file, such as `index.js` or `App.js`:
41
+
3. To finalize the installation of `react-native-gesture-handler`, add the following at the **top** (make sure it's at the top and there's nothing else before it) of your entry file, such as `index.js` or `App.js`:
42
42
43
43
```js
44
44
import'react-native-gesture-handler';
@@ -50,7 +50,7 @@ Then, you need to install and configure the libraries that are required by the d
50
50
51
51
:::
52
52
53
-
3. If you're on a Mac and developing for iOS, you also need to install the pods (via [Cocoapods](https://cocoapods.org/)) to complete the linking.
53
+
4. If you're on a Mac and developing for iOS, you also need to install the pods (via [Cocoapods](https://cocoapods.org/)) to complete the linking.
Then, you need to install and configure the libraries that are required by the drawer navigator:
24
24
25
-
1. First, install [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/).
25
+
1. First, install [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/) (at least version 2 or 3).
26
26
27
27
If you have a Expo managed project, in your project directory, run:
28
28
@@ -36,9 +36,9 @@ Then, you need to install and configure the libraries that are required by the d
The Drawer supports both Reanimated 1 and the latest version of Reanimated. If you want to use the latest version of Reanimated, make sure to configure it following the [installation guide](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started).
39
+
2. Configure the Reanimated Babel Plugin in your project following the [installation guide](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started).
40
40
41
-
2. To finalize installation of `react-native-gesture-handler`, add the following at the **top** (make sure it's at the top and there's nothing else before it) of your entry file, such as `index.js` or `App.js`:
41
+
3. To finalize the installation of `react-native-gesture-handler`, add the following at the **top** (make sure it's at the top and there's nothing else before it) of your entry file, such as `index.js` or `App.js`:
42
42
43
43
```js
44
44
import'react-native-gesture-handler';
@@ -50,7 +50,7 @@ Then, you need to install and configure the libraries that are required by the d
50
50
51
51
:::
52
52
53
-
3. If you're on a Mac and developing for iOS, you also need to install the pods (via [Cocoapods](https://cocoapods.org/)) to complete the linking.
53
+
4. If you're on a Mac and developing for iOS, you also need to install the pods (via [Cocoapods](https://cocoapods.org/)) to complete the linking.
Now, if you have a stack with the history `Home > Profile (userId: bob) > Settings` and you call `navigate(Profile, { userId: 'alice' })`, the resulting screens will be `Home > Profile (userId: bob) > Settings > Profile (userId: alice)` since it'll add a new `Profile` screen as no matching screen was found.
248
248
249
+
### `navigateDeprecated`
250
+
251
+
:::warning
252
+
253
+
This method is deprecated and will be removed in a future release. It only exists for compatibility purposes. Use `navigate` instead.
254
+
255
+
:::
256
+
257
+
TODO
258
+
249
259
### `goBack`
250
260
251
261
The `goBack` method lets us go back to the previous screen in the navigator.
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/screen-options.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -141,7 +141,7 @@ export default function App() {
141
141
</TabItem>
142
142
</Tabs>
143
143
144
-
You can also pass a function to `options`. The function will receive the [`navigation` object](navigation-object.md) and the [`route` object](route-object.md) for that screen. This can be useful if you want to perform navigation in your options:
144
+
You can also pass a function to `options`. The function will receive the [`navigation` object](navigation-object.md) and the [`route` object](route-object.md) for that screen, as well as the [`theme` object](themes.md). This can be useful if you want to perform navigation in your options:
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/stack-navigator.md
+16-4
Original file line number
Diff line number
Diff line change
@@ -255,10 +255,6 @@ This is shortcut option which configures several options to configure the style
255
255
256
256
See [Transparent modals](#transparent-modals) for more details on how to customize `transparentModal`.
257
257
258
-
#### `animationEnabled`
259
-
260
-
Whether transition animation should be enabled on the screen. If you set it to `false`, the screen won't animate when pushing or popping. Defaults to `true` on iOS and Android, `false` on Web.
261
-
262
258
#### `animationTypeForReplace`
263
259
264
260
The type of animation to use when this screen replaces another screen. It takes the following values:
@@ -646,6 +642,22 @@ function MyStack() {
646
642
647
643
## Animations
648
644
645
+
You can specify the `animation` option to customize the transition animation for screens being pushed or popped.
646
+
647
+
Supported values for `animation` are:
648
+
649
+
-`default` - Default animation based on the platform and OS version.
650
+
-`fade` - Simple fade animation for dialogs.
651
+
-`fade_from_bottom` - Standard Android-style fade in from the bottom for Android Oreo.
652
+
-`reveal_from_bottom` - Standard Android-style reveal from the bottom for Android Pie.
653
+
-`scale_from_center` - Scale animation from the center.
654
+
-`slide_from_right` - Standard iOS-style slide in from the right.
655
+
-`slide_from_left` - Similar to `slide_from_right`, but the screen will slide in from the left.
656
+
-`slide_from_bottom` - Slide animation from the bottom for modals and bottom sheets.
657
+
-`none` - The screens are pushed or popped immediately without any animation.
658
+
659
+
By default, Android and iOS use the `default` animation and other platforms use `none`.
660
+
649
661
### Animation related options
650
662
651
663
Stack Navigator exposes various options to configure the transition animation when a screen is added or removed. These transition animations can be customized on a per-screen basis by specifying the options in the `options` prop for each screen.
0 commit comments