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
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
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
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
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.
0 commit comments