Skip to content

Commit dad6ce9

Browse files
committed
Fix the descriptions for navigation object
1 parent 5bddf22 commit dad6ce9

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

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

+9-5
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ sidebar_label: Navigation prop
77
Each `screen` component in your app is provided with the `navigation` prop automatically. The prop contains various convenience functions that dispatch navigation actions. It looks like this:
88

99
- `navigation`
10-
- `navigate` - go to another screen, figures out the action it needs to take to do it
11-
- `reset` - wipe the navigator state and replace it with a new route
12-
- `goBack` - close active screen and move back in the stack
13-
- `setParams` - make changes to route's params
10+
- `navigate` - go to the given screen, this will behave differently based on the navigator
11+
- `goBack` - go back to the previous screen, this will pop the current screen when used in a stack
12+
- `reset` - replace the navigation state of the navigator with the given state
13+
- `setParams` - merge new params onto the route's params
1414
- `dispatch` - send an action object to update the [navigation state](navigation-state.md)
1515
- `setOptions` - update the screen's options
1616
- `isFocused` - check whether the screen is focused
17-
- `addListener` - subscribe to updates to events from the navigators
17+
- `canGoBack` - check whether it's possible to go back from the current screen
18+
- `getState` - get the navigation state of the navigator
19+
- `getParent` - get the navigation object of the parent screen, if any
20+
- `addListener` - subscribe to events for the screen
21+
- `removeListener` - unsubscribe from events for the screen
1822

1923
It's important to highlight the `navigation` prop is _not_ passed in to _all_ components; only `screen` components receive this prop automatically! React Navigation doesn't do any magic here. For example, if you were to define a `MyBackButton` component and render it as a child of a screen component, you would not be able to access the `navigation` prop on it. If, however, you wish to access the `navigation` prop in any of your components, you may use the [`useNavigation`](use-navigation.md) hook.
2024

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

+9-5
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ sidebar_label: Navigation prop
77
Each `screen` component in your app is provided with the `navigation` prop automatically. The prop contains various convenience functions that dispatch navigation actions. It looks like this:
88

99
- `navigation`
10-
- `navigate` - go to another screen, figures out the action it needs to take to do it
11-
- `reset` - wipe the navigator state and replace it with a new route
12-
- `goBack` - close active screen and move back in the stack
13-
- `setParams` - make changes to route's params
10+
- `navigate` - go to the given screen, this will behave differently based on the navigator
11+
- `goBack` - go back to the previous screen, this will pop the current screen when used in a stack
12+
- `reset` - replace the navigation state of the navigator with the given state
13+
- `setParams` - merge new params onto the route's params
1414
- `dispatch` - send an action object to update the [navigation state](navigation-state.md)
1515
- `setOptions` - update the screen's options
1616
- `isFocused` - check whether the screen is focused
17-
- `addListener` - subscribe to updates to events from the navigators
17+
- `canGoBack` - check whether it's possible to go back from the current screen
18+
- `getState` - get the navigation state of the navigator
19+
- `getParent` - get the navigation object of the parent screen, if any
20+
- `addListener` - subscribe to events for the screen
21+
- `removeListener` - unsubscribe from events for the screen
1822

1923
It's important to highlight the `navigation` prop is _not_ passed in to _all_ components; only `screen` components receive this prop automatically! React Navigation doesn't do any magic here. For example, if you were to define a `MyBackButton` component and render it as a child of a screen component, you would not be able to access the `navigation` prop on it. If, however, you wish to access the `navigation` prop in any of your components, you may use the [`useNavigation`](use-navigation.md) hook.
2024

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

+9-5
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ import TabItem from '@theme/TabItem';
1010
The `navigation` object contains various convenience functions that dispatch navigation actions. It looks like this:
1111

1212
- `navigation`
13-
- `navigate` - go to another screen, figures out the action it needs to take to do it
14-
- `reset` - wipe the navigator state and replace it with a new route
15-
- `goBack` - close active screen and move back in the stack
16-
- `setParams` - make changes to route's params
13+
- `navigate` - go to the given screen, this will behave differently based on the navigator
14+
- `goBack` - go back to the previous screen, this will pop the current screen when used in a stack
15+
- `reset` - replace the navigation state of the navigator with the given state
16+
- `setParams` - merge new params onto the route's params
1717
- `dispatch` - send an action object to update the [navigation state](navigation-state.md)
1818
- `setOptions` - update the screen's options
1919
- `isFocused` - check whether the screen is focused
20-
- `addListener` - subscribe to updates to events from the navigators
20+
- `canGoBack` - check whether it's possible to go back from the current screen
21+
- `getState` - get the navigation state of the navigator
22+
- `getParent` - get the navigation object of the parent screen, if any
23+
- `addListener` - subscribe to events for the screen
24+
- `removeListener` - unsubscribe from events for the screen
2125

2226
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.
2327

0 commit comments

Comments
 (0)