Skip to content

Commit 2129b35

Browse files
committed
Document isReady method
1 parent f111a4c commit 2129b35

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ All of these methods will act as if they were called inside the currently focuse
7272

7373
In addition to these methods, the ref object also includes the following special methods:
7474

75+
#### `isReady`
76+
77+
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.
78+
79+
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+
7581
#### `resetRoot`
7682

7783
The `resetRoot` method lets you reset the state of the navigation tree to the specified state object:

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ All of these methods will act as if they were called inside the currently focuse
7373

7474
In addition to these methods, the ref object also includes the following special methods:
7575

76+
#### `isReady`
77+
78+
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.
79+
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.
81+
7682
#### `resetRoot`
7783

7884
The `resetRoot` method lets you reset the state of the navigation tree to the specified state object:
@@ -214,6 +220,10 @@ Example:
214220
</NavigationContainer>
215221
```
216222

223+
This callback won't fire if there are no navigators rendered inside the container.
224+
225+
The current status can be obtained with the [`isReady`](#isready) method on the ref.
226+
217227
### `onUnhandledAction`
218228

219229
Function which is called when a navigation action is not handled by any of the navigators.

0 commit comments

Comments
 (0)