Skip to content

Commit df547bd

Browse files
committed
Use 'object' instead 'prop' termibology for navigation & route
1 parent 716ea0d commit df547bd

31 files changed

+87
-159
lines changed

versioned_docs/version-7.x/bottom-tab-navigator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The `Tab.Navigator` component accepts following props:
5353

5454
#### `id`
5555

56-
Optional unique ID for the navigator. This can be used with [`navigation.getParent`](navigation-prop.md#getparent) to refer to this navigator in a child navigator.
56+
Optional unique ID for the navigator. This can be used with [`navigation.getParent`](navigation-object.md#getparent) to refer to this navigator in a child navigator.
5757

5858
#### `initialRouteName`
5959

@@ -442,7 +442,7 @@ React.useEffect(() => {
442442

443443
### Helpers
444444

445-
The tab navigator adds the following methods to the navigation prop:
445+
The tab navigator adds the following methods to the navigation object:
446446

447447
#### `jumpTo`
448448

versioned_docs/version-7.x/connecting-navigation-prop.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

versioned_docs/version-7.x/custom-navigators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The hook returns an object with following properties:
4040
- `navigation` - The navigation object containing various helper methods for the navigator to manipulate the [navigation state](navigation-state.md). This isn't the same as the navigation object for the screen and includes some helpers such as `emit` to emit events to the screens.
4141
- `descriptors` - This is an object containing descriptors for each route with the route keys as its properties. The descriptor for a route can be accessed by `descriptors[route.key]`. Each descriptor contains the following properties:
4242

43-
- `navigation` - The navigation prop for the screen. You don't need to pass this to the screen manually. But it's useful if we're rendering components outside the screen that need to receive `navigation` prop as well, such as a header component.
43+
- `navigation` - The navigation object for the screen. You don't need to pass this to the screen manually. But it's useful if we're rendering components outside the screen that need to receive `navigation` prop as well, such as a header component.
4444
- `options` - A getter which returns the options such as `title` for the screen if they are specified.
4545
- `render` - A function which can be used to render the actual screen. Calling `descriptors[route.key].render()` will return a React element containing the screen content. It's important to use this method to render a screen, otherwise any child navigators won't be connected to the navigation tree properly.
4646

versioned_docs/version-7.x/custom-routers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ const MyTabRouter = options => {
182182
};
183183
```
184184

185-
Instead of writing a custom router to handle custom actions, you can [pass a function to `dispatch`](navigation-prop.md#dispatch) instead. It's cleaner and recommended instead of overriding routers.
185+
Instead of writing a custom router to handle custom actions, you can [pass a function to `dispatch`](navigation-object.md#dispatch) instead. It's cleaner and recommended instead of overriding routers.
186186

187187
### Blocking Navigation Actions
188188

versioned_docs/version-7.x/drawer-navigator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ The `Drawer.Navigator` component accepts following props:
9191

9292
#### `id`
9393

94-
Optional unique ID for the navigator. This can be used with [`navigation.getParent`](navigation-prop.md#getparent) to refer to this navigator in a child navigator.
94+
Optional unique ID for the navigator. This can be used with [`navigation.getParent`](navigation-object.md#getparent) to refer to this navigator in a child navigator.
9595

9696
#### `initialRouteName`
9797

@@ -529,7 +529,7 @@ If you have custom drawer content, make sure to emit this event.
529529

530530
### Helpers
531531

532-
The drawer navigator adds the following methods to the navigation prop:
532+
The drawer navigator adds the following methods to the navigation object:
533533

534534
#### `openDrawer`
535535

versioned_docs/version-7.x/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ There are 2 primary ways to configure the navigators:
129129

130130
The static configuration API has reduced boilerplate and simplifies things such as TypeScript types and deep linking. If you're starting a new project or are new to React Navigation, this is the **recommended way** to set up your app.
131131

132-
Continue to ["Hello React Navigation"](hello-react-navigation.md?config=static) to start writing some code with the Static API.
132+
Continue to ["Hello React Navigation"](hello-react-navigation.md?config=static) to start writing some code with the static API.
133133

134134
### Dynamic configuration
135135

@@ -154,4 +154,4 @@ In a typical React Native app, the `NavigationContainer` should be only used onc
154154

155155
:::
156156

157-
Continue to ["Hello React Navigation"](hello-react-navigation.md?config=dynamic) to start writing some code with the Dynamic API.
157+
Continue to ["Hello React Navigation"](hello-react-navigation.md?config=dynamic) to start writing some code with the dynamic API.

versioned_docs/version-7.x/glossary-of-terms.md

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -55,41 +55,32 @@ const StackNavigator = (
5555

5656
The suffix `Screen` in the component name is entirely optional, but a frequently used convention; we could call it `Michael` and this would work just the same.
5757

58-
We saw earlier that our screen components are provided with the `navigation` prop. It's important to note that _this only happens if the screen is rendered as a route by React Navigation_ (for example, in response to `navigation.navigate`). For example, if we render `DetailsScreen` as a child of `HomeScreen`, then `DetailsScreen` won't be provided with the `navigation` prop, and when you press the "Go to Details... again" button on the Home screen, the app will throw one of the quintessential JavaScript exceptions "undefined is not an object".
58+
## Navigation object
5959

60-
```js
61-
function HomeScreen() {
62-
return (
63-
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
64-
<Text>Home Screen</Text>
65-
<Button
66-
title="Go to Details"
67-
onPress={() => navigation.navigate('Details')}
68-
/>
69-
<DetailsScreen />
70-
</View>
71-
);
72-
}
73-
```
74-
75-
The ["Navigation prop reference"](navigation-prop.md) section goes into more detail on this, describes workarounds, and provides more information on other properties available on `navigation` prop.
76-
77-
## Navigation Prop
78-
79-
This prop will be passed to all screens, and it can be used for the following:
60+
The navigation object contains methods used for navigation. It contains methods such as:
8061

8162
- `dispatch` will send an action up to the router
8263
- `navigate`, `goBack`, etc are available to dispatch actions in a convenient way
8364

84-
Navigators can also accept a navigation prop, which they should get from the parent navigator, if there is one.
65+
This object can be accessed with the [`useNavigation`](use-navigation.md) hook. It's also passed as a prop to screens defined with the dynamic API.
8566

86-
For more details, see the ["Navigation prop document"](navigation-prop.md).
67+
For more details, see the ["Navigation object docs"](navigation-object.md).
8768

88-
The ["Route prop reference"](route-prop.md) section goes into more detail on this, describes workarounds, and provides more information on other properties available on `route` prop.
69+
The ["Route object reference"](route-object.md) section goes into more detail on this, describes workarounds, and provides more information on other properties available on `route` prop.
8970

90-
## Route Prop
71+
## Route object
9172

92-
This prop will be passed to all screens. Contains information about current route i.e. `params`, `key` and `name`.
73+
This prop will be passed to all screens. Contains information about the current route i.e. `params`, `key` and `name`. It can also contain arbitrary params:
74+
75+
```js
76+
{
77+
key: 'B',
78+
name: 'Profile',
79+
params: { id: '123' }
80+
}
81+
```
82+
83+
For more details, see the ["Route object reference"](route-object.md).
9384

9485
## Navigation State
9586

@@ -110,18 +101,6 @@ For this navigation state, there are two routes (which may be tabs, or cards in
110101

111102
You can read more about the navigation state [here](navigation-state.md).
112103

113-
## Route
114-
115-
Each route is an object which contains a key to identify it, and a "name" to designate the type of route. It can also contain arbitrary params:
116-
117-
```js
118-
{
119-
key: 'B',
120-
name: 'Profile',
121-
params: { id: '123' }
122-
}
123-
```
124-
125104
## Header
126105

127106
Also known as navigation header, navigation bar, app bar, and probably many other things. This is the rectangle at the top of your screen that contains the back button and the title for your screen. The entire rectangle is often referred to as the header in React Navigation.

versioned_docs/version-7.x/group.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Options to configure how the screens inside the group get presented in the navig
4949
</Stack.Group>
5050
```
5151

52-
When you pass a function, it'll receive the [`route`](route-prop.md) and [`navigation`](navigation-prop.md):
52+
When you pass a function, it'll receive the [`route`](route-object.md) and [`navigation`](navigation-object.md):
5353

5454
```js
5555
<Stack.Group

versioned_docs/version-7.x/headers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ function StackScreen() {
5353

5454
The argument that is passed in to the `options` function is an object with the following properties:
5555

56-
- `navigation` - The [navigation prop](navigation-prop.md) for the screen.
57-
- `route` - The [route prop](route-prop.md) for the screen
56+
- `navigation` - The [navigation object](navigation-object.md) for the screen.
57+
- `route` - The [route object](route-object.md) for the screen
5858

5959
We only needed the `route` prop in the above example but you may in some cases want to use `navigation` as well.
6060

versioned_docs/version-7.x/material-top-tab-navigator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ The `Tab.Navigator` component accepts following props:
7575

7676
#### `id`
7777

78-
Optional unique ID for the navigator. This can be used with [`navigation.getParent`](navigation-prop.md#getparent) to refer to this navigator in a child navigator.
78+
Optional unique ID for the navigator. This can be used with [`navigation.getParent`](navigation-object.md#getparent) to refer to this navigator in a child navigator.
7979

8080
#### `initialRouteName`
8181

@@ -408,7 +408,7 @@ React.useEffect(() => {
408408

409409
### Helpers
410410

411-
The tab navigator adds the following methods to the navigation prop:
411+
The tab navigator adds the following methods to the navigation object:
412412

413413
#### `jumpTo`
414414

0 commit comments

Comments
 (0)