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-7.x/navigation-object.md
+22-2Lines changed: 22 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -244,7 +244,8 @@ In a stack navigator ([stack](stack-navigator.md) or [native stack](native-stack
244
244
245
245
- If you're already on a screen with the same name, it will update its params and not push a new screen.
246
246
- If you're on a different screen, it will push the new screen onto the stack.
247
-
- If the [`getId`](screen.md#getid) prop is specified, and another screen in the stack has the same ID, it will navigate to that screen and update its params instead.
247
+
- If the [`getId`](screen.md#getid) prop is specified, and another screen in the stack has the same ID, it will bring that screen to focus and update its params instead.
248
+
- If none of the above conditions match, it'll push a new screen to the stack.
248
249
249
250
By default, the screen is identified by its name. But you can also customize it to take the params into account by using the [`getId`](screen.md#getid) prop.
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.
281
283
284
+
In a tab or drawer navigator, calling `navigate` will switch to the relevant screen if it's not focused already and update the params of the screen.
285
+
282
286
### `navigateDeprecated`
283
287
284
288
:::warning
@@ -287,7 +291,23 @@ This method is deprecated and will be removed in a future release. It only exist
287
291
288
292
:::
289
293
290
-
TODO
294
+
The `navigateDeprecated` action implements the old behavior of `navigate` from previous versions.
295
+
296
+
It takes the following arguments:
297
+
298
+
`navigation.navigateDeprecated(name, params)`
299
+
300
+
-`name` - A destination name of the route that has been defined somewhere
301
+
-`params` - Params to pass to the destination route.
302
+
303
+
In a stack navigator ([stack](stack-navigator.md) or [native stack](native-stack-navigator.md)), calling `navigate` with a screen name will have the following behavior:
304
+
305
+
- If you're already on a screen with the same name, it will update its params and not push a new screen.
306
+
- If a screen with the same name already exists in the stack, it will pop all the screens after it to go back to the existing screen.
307
+
- If the [`getId`](screen.md#getid) prop is specified, and another screen in the stack has the same ID, it will pop any screens to navigate to that screen and update its params instead.
308
+
- If none of the above conditions match, it'll push a new screen to the stack.
309
+
310
+
In a tab or drawer navigator, calling `navigate` will switch to the relevant screen if it's not focused already and update the params of the screen.
0 commit comments