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
See the project's `README.md` for more information on how to get started.
25
+
16
26
### Installation and setup
17
27
18
28
First, you need to install them in your project:
@@ -43,26 +53,9 @@ Next, install the required peer dependencies. You need to run different commands
43
53
cd ..
44
54
```
45
55
46
-
:::note
47
-
You might get warnings related to peer dependencies after installation. They are usually caused by incorrect version ranges specified in some packages. You can safely ignore most warnings as long as your app builds.
48
-
:::
49
-
50
-
Now, you need to wrap the whole app in `NavigationContainer`. Usually you'd do this in your entry file, such as `index.js` or `App.js`:
Once you've installed and configured the dependencies, you can move on to setting up your project to use React Navigation.
63
57
64
-
exportdefaultApp;
65
-
```
58
+
When using React Navigation, you configure [navigators](https://reactnavigation.org/docs/glossary-of-terms#navigator) in your app. Navigators handle the transition between screens in your app and provide UI such as header, tab bar etc.
66
59
67
60
Now you are ready to build and run your app on the device/simulator.
68
61
@@ -72,35 +65,40 @@ Now you can create an app with a home screen and a profile screen:
In this example, there are 2 screens (`Home` and `Profile`) defined using the `Stack.Screen` component. Similarly, you can define as many screens as you like.
90
+
In this example, `RootStack` is a navigator with 2 screens (`Home` and `Profile`), defined in the `screens` property in `createNativeStackNavigator`. Similarly, you can define as many screens as you like.
97
91
98
-
You can set options such as the screen title for each screen in the `options`prop of `Stack.Screen`.
92
+
You can specify options such as the screen title for each screen in the `options`property of each screen. Each screen definition also needs a `screen` property that is a React component or another navigator.
99
93
100
-
Each screen takes a `component` prop that is a React component. Those components receive a prop called `navigation` which has various methods to link to other screens. For example, you can use `navigation.navigate` to go to the `Profile` screen:
94
+
Inside each screen component, you can use the `useNavigation` hook to get the `navigation` object, which has various methods to link to other screens. For example, you can use `navigation.navigate` to go to the `Profile` screen:
return <Text>This is {route.params.name}'s profile</Text>;
115
-
};
114
+
}
116
115
```
117
116
118
-
This `native-stack` navigator uses the native APIs: `UINavigationController` on iOS and `Fragment` on Android so that navigation built with `createNativeStackNavigator` will behave the same and have the same performance characteristics as apps built natively on top of those APIs.
117
+
This `native-stack` navigator uses the native APIs: `UINavigationController` on iOS and `Fragment` on Android so that navigation built with `createNativeStackNavigator` will behave the same and have the similar performance characteristics as apps built natively on top of those APIs.
119
118
120
119
React Navigation also has packages for different kind of navigators such as tabs and drawer. You can use them to implement various patterns in your app.
Copy file name to clipboardExpand all lines: website/versioned_docs/version-0.73/navigation.md
+33-44Lines changed: 33 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,26 +43,9 @@ Next, install the required peer dependencies. You need to run different commands
43
43
cd ..
44
44
```
45
45
46
-
:::note
47
-
You might get warnings related to peer dependencies after installation. They are usually caused by incorrect version ranges specified in some packages. You can safely ignore most warnings as long as your app builds.
48
-
:::
46
+
Once you've installed and configured the dependencies, you can move on to setting up your project to use React Navigation.
49
47
50
-
Now, you need to wrap the whole app in `NavigationContainer`. Usually you'd do this in your entry file, such as `index.js` or `App.js`:
When using React Navigation, you configure [navigators](https://reactnavigation.org/docs/glossary-of-terms#navigator) in your app. Navigators handle the transition between screens in your app and provide UI such as header, tab bar etc.
66
49
67
50
Now you are ready to build and run your app on the device/simulator.
68
51
@@ -72,35 +55,40 @@ Now you can create an app with a home screen and a profile screen:
In this example, there are 2 screens (`Home` and `Profile`) defined using the `Stack.Screen` component. Similarly, you can define as many screens as you like.
80
+
In this example, `RootStack` is a navigator with 2 screens (`Home` and `Profile`), defined in the `screens` property in `createNativeStackNavigator`. Similarly, you can define as many screens as you like.
97
81
98
-
You can set options such as the screen title for each screen in the `options`prop of `Stack.Screen`.
82
+
You can specify options such as the screen title for each screen in the `options`property of each screen. Each screen definition also needs a `screen` property that is a React component or another navigator.
99
83
100
-
Each screen takes a `component` prop that is a React component. Those components receive a prop called `navigation` which has various methods to link to other screens. For example, you can use `navigation.navigate` to go to the `Profile` screen:
84
+
Inside each screen component, you can use the `useNavigation` hook to get the `navigation` object, which has various methods to link to other screens. For example, you can use `navigation.navigate` to go to the `Profile` screen:
return <Text>This is {route.params.name}'s profile</Text>;
115
-
};
104
+
}
116
105
```
117
106
118
-
This `native-stack` navigator uses the native APIs: `UINavigationController` on iOS and `Fragment` on Android so that navigation built with `createNativeStackNavigator` will behave the same and have the same performance characteristics as apps built natively on top of those APIs.
107
+
This `native-stack` navigator uses the native APIs: `UINavigationController` on iOS and `Fragment` on Android so that navigation built with `createNativeStackNavigator` will behave the same and have the similar performance characteristics as apps built natively on top of those APIs.
119
108
120
109
React Navigation also has packages for different kind of navigators such as tabs and drawer. You can use them to implement various patterns in your app.
Copy file name to clipboardExpand all lines: website/versioned_docs/version-0.74/navigation.md
+33-44Lines changed: 33 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,26 +43,9 @@ Next, install the required peer dependencies. You need to run different commands
43
43
cd ..
44
44
```
45
45
46
-
:::note
47
-
You might get warnings related to peer dependencies after installation. They are usually caused by incorrect version ranges specified in some packages. You can safely ignore most warnings as long as your app builds.
48
-
:::
46
+
Once you've installed and configured the dependencies, you can move on to setting up your project to use React Navigation.
49
47
50
-
Now, you need to wrap the whole app in `NavigationContainer`. Usually you'd do this in your entry file, such as `index.js` or `App.js`:
When using React Navigation, you configure [navigators](https://reactnavigation.org/docs/glossary-of-terms#navigator) in your app. Navigators handle the transition between screens in your app and provide UI such as header, tab bar etc.
66
49
67
50
Now you are ready to build and run your app on the device/simulator.
68
51
@@ -72,35 +55,40 @@ Now you can create an app with a home screen and a profile screen:
In this example, there are 2 screens (`Home` and `Profile`) defined using the `Stack.Screen` component. Similarly, you can define as many screens as you like.
80
+
In this example, `RootStack` is a navigator with 2 screens (`Home` and `Profile`), defined in the `screens` property in `createNativeStackNavigator`. Similarly, you can define as many screens as you like.
97
81
98
-
You can set options such as the screen title for each screen in the `options`prop of `Stack.Screen`.
82
+
You can specify options such as the screen title for each screen in the `options`property of each screen. Each screen definition also needs a `screen` property that is a React component or another navigator.
99
83
100
-
Each screen takes a `component` prop that is a React component. Those components receive a prop called `navigation` which has various methods to link to other screens. For example, you can use `navigation.navigate` to go to the `Profile` screen:
84
+
Inside each screen component, you can use the `useNavigation` hook to get the `navigation` object, which has various methods to link to other screens. For example, you can use `navigation.navigate` to go to the `Profile` screen:
return <Text>This is {route.params.name}'s profile</Text>;
115
-
};
104
+
}
116
105
```
117
106
118
-
This `native-stack` navigator uses the native APIs: `UINavigationController` on iOS and `Fragment` on Android so that navigation built with `createNativeStackNavigator` will behave the same and have the same performance characteristics as apps built natively on top of those APIs.
107
+
This `native-stack` navigator uses the native APIs: `UINavigationController` on iOS and `Fragment` on Android so that navigation built with `createNativeStackNavigator` will behave the same and have the similar performance characteristics as apps built natively on top of those APIs.
119
108
120
109
React Navigation also has packages for different kind of navigators such as tabs and drawer. You can use them to implement various patterns in your app.
0 commit comments