Skip to content

Commit 17b756f

Browse files
committed
Update references to navigation prop
1 parent 58c6541 commit 17b756f

22 files changed

Lines changed: 41 additions & 38 deletions

blog/2021-08-14-react-navigation-6.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ We simplified many APIs with React Navigation 6 to address common use cases. For
6262
- Custom header doesn't require setting `headerMode="screen"` manually anymore
6363
- The `useHeaderHeight` hook now ignores hidden headers and returns the height of the closest visible header in parent
6464
- New option to set a [custom background](/docs/6.x/bottom-tab-navigator#tabbarbackground) (such as `BlurView`) for tab bar without having to use a custom tab bar
65-
- New API to manage ref on the container [(`createNavigationContainerRef` and `useNavigationContainerRef`)](/docs/6.x/navigating-without-navigation-prop)
65+
- New API to manage ref on the container [(`createNavigationContainerRef` and `useNavigationContainerRef`)](/docs/6.x/navigation-ref)
6666

6767
### New `Group` component for organization
6868

versioned_docs/version-5.x/navigation-container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ You can use it to track the focused screen, persist the navigation state etc.
185185
186186
Function which is called after the navigation container and all its children finish mounting for the first time. You can use it for:
187187
188-
- Making sure that the `ref` is usable. See [docs regarding initialization of the ref](navigating-without-navigation-prop.md#handling-initialization) for more details.
188+
- Making sure that the `ref` is usable. See [Navigation ref](navigation-ref.md#handling-initialization) for more details.
189189
- Hiding your native splash screen
190190
191191
### `linking`

versioned_docs/version-5.x/navigating-without-navigation-prop.md renamed to versioned_docs/version-5.x/navigation-ref.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
id: navigating-without-navigation-prop
3-
title: Navigating without the navigation prop
4-
sidebar_label: Navigating without the navigation prop
2+
id: navigation-ref
3+
title: Navigation ref
4+
sidebar_label: Navigation ref
55
---
66

77
Sometimes you need to trigger a navigation action from places where you do not have access to the `navigation` prop, such as a Redux middleware. For such cases, you can dispatch navigation actions from the navigation container.

versioned_docs/version-6.x/navigation-container.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function App() {
5757

5858
If you're using a regular ref object, keep in mind that the ref may be initially `null` in some situations (such as when linking is enabled). To make sure that the ref is initialized, you can use the [`onReady`](#onready) callback to get notified when the navigation container finishes mounting.
5959

60-
See the [Navigating without the navigation prop](navigating-without-navigation-prop.md) guide for more details.
60+
See the [Navigation ref](navigation-ref.md) guide for more details.
6161

6262
### Methods on the ref
6363

@@ -77,7 +77,7 @@ In addition to these methods, the ref object also includes the following special
7777

7878
The `isReady` method returns a `boolean` indicating whether the navigation tree is ready. The navigation tree is ready when the `NavigationContainer` contains at least one navigator and all of the navigators have finished mounting.
7979

80-
This can be used to determine whether it's safe to dispatch navigation actions without getting an error. See [handling initialization](navigating-without-navigation-prop.md#handling-initialization) for more details.
80+
This can be used to determine whether it's safe to dispatch navigation actions without getting an error. See [handling initialization](navigation-ref.md#handling-initialization) for more details.
8181

8282
#### `resetRoot`
8383

@@ -207,7 +207,7 @@ Example:
207207

208208
Function which is called after the navigation container and all its children finish mounting for the first time. You can use it for:
209209

210-
- Making sure that the `ref` is usable. See [docs regarding initialization of the ref](navigating-without-navigation-prop.md#handling-initialization) for more details.
210+
- Making sure that the `ref` is usable. See [Navigation ref](navigation-ref.md#handling-initialization) for more details.
211211
- Hiding your native splash screen
212212

213213
Example:

versioned_docs/version-6.x/navigating-without-navigation-prop.md renamed to versioned_docs/version-6.x/navigation-ref.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
id: navigating-without-navigation-prop
3-
title: Navigating without the navigation prop
4-
sidebar_label: Navigating without the navigation prop
2+
id: navigation-ref
3+
title: Navigation ref
4+
sidebar_label: Navigation ref
55
---
66

77
Sometimes you need to trigger a navigation action from places where you do not have access to the `navigation` prop, such as a Redux middleware. For such cases, you can dispatch navigation actions use a [`ref` on the navigation container](navigation-container.md#ref).

versioned_docs/version-6.x/upgrading-from-5.x.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ See docs for [Navigation Events](navigation-events.md#screenlisteners-prop-on-th
280280

281281
The new `useNavigationContainerRef` hook and `createNavigationContainerRef` helper are useful for simplifying adding a ref to to `NavigationContainer`.
282282

283-
See docs for [`NavigationContainer`](navigation-container.md#ref) and [Navigating without the navigation prop](navigating-without-navigation-prop.md) for more details and examples.
283+
See docs for [`NavigationContainer`](navigation-container.md#ref) and [Navigation ref](navigation-ref.md) for more details and examples.
284284

285285
### `useNavigation`, `Link`, `useLinkProps` etc. now work outside a screen
286286

versioned_docs/version-7.x/navigation-container.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ If you're using a regular ref object, keep in mind that the ref may be initially
176176

177177
Check how to setup `ref` with TypeScript [here](typescript.md#annotating-ref-on-navigationcontainer).
178178

179-
See the [Navigating without the navigation prop](navigating-without-navigation-prop.md) guide for more details.
179+
See the [Navigation ref](navigation-ref.md) guide for more details.
180180

181181
### Methods on the ref
182182

@@ -196,7 +196,7 @@ In addition to these methods, the ref object also includes the following special
196196

197197
The `isReady` method returns a `boolean` indicating whether the navigation tree is ready. The navigation tree is ready when the `NavigationContainer` contains at least one navigator and all of the navigators have finished mounting.
198198

199-
This can be used to determine whether it's safe to dispatch navigation actions without getting an error. See [handling initialization](navigating-without-navigation-prop.md#handling-initialization) for more details.
199+
This can be used to determine whether it's safe to dispatch navigation actions without getting an error. See [handling initialization](navigation-ref.md#handling-initialization) for more details.
200200

201201
#### `resetRoot`
202202

@@ -418,7 +418,7 @@ Example:
418418

419419
Function which is called after the navigation container and all its children finish mounting for the first time. You can use it for:
420420

421-
- Making sure that the `ref` is usable. See [docs regarding initialization of the ref](navigating-without-navigation-prop.md#handling-initialization) for more details.
421+
- Making sure that the `ref` is usable. See [Navigation ref](navigation-ref.md#handling-initialization) for more details.
422422
- Hiding your native splash screen
423423

424424
Example:

versioned_docs/version-7.x/navigation-object.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ The `navigation` object contains various convenience functions that dispatch nav
2424
- `addListener` - subscribe to events for the screen
2525
- `removeListener` - unsubscribe from events for the screen
2626

27-
The `navigation` object can be accessed inside any screen component with the [`useNavigation`](use-navigation.md) hook. It's also passed as a prop only to screens components defined with the dynamic API.
27+
The `navigation` object can be accessed inside any screen component with the [`useNavigation`](use-navigation.md) hook.
28+
29+
Screen components defined with the dynamic API also receive the `navigation` object as a prop. Consider it legacy and prefer using the `useNavigation` hook instead.
2830

2931
:::warning
3032

versioned_docs/version-7.x/navigating-without-navigation-prop.md renamed to versioned_docs/version-7.x/navigation-ref.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
id: navigating-without-navigation-prop
3-
title: Navigating without the navigation prop
4-
sidebar_label: Navigation Ref
2+
id: navigation-ref
3+
title: Navigation ref
4+
sidebar_label: Navigation ref
55
---
66

77
import Tabs from '@theme/Tabs';

versioned_docs/version-7.x/navigation-state.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ The state object is guaranteed to not be stale when accessing it with built-in A
141141

142142
- Navigator's state with [`useNavigationState()`](use-navigation-state.md) or [`navigation.getState()`](navigation-object.md#getstate) - not including child navigators.
143143
- Complete state of the navigation tree with [`ref.getRootState()`](navigation-container.md#getrootstate) including root navigator and all child navigators.
144-
-
145144

146145
However, if you try to access a child navigator's state with the `state` property on the [`route`](route-object.md) object, it maybe a stale or partial state object. So it's not recommended to use this property directly.
147146

0 commit comments

Comments
 (0)