mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-28 12:25:21 +08:00
chore: prepare for stable release (#354)
This commit is contained in:
@@ -2,83 +2,4 @@
|
||||
|
||||
Stack navigator for React Native using native primitives for navigation. Uses [`react-native-screens`](https://github.com/kmagiera/react-native-screens) under the hood.
|
||||
|
||||
Documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/en/next/native-stack-navigator.html).
|
||||
|
||||
Expo SDK 35 and lower is not supported as it includes an older version of `react-native-screens`.
|
||||
|
||||
## Installation
|
||||
|
||||
Open a Terminal in your project's folder and run,
|
||||
|
||||
```sh
|
||||
yarn add @react-navigation/native @react-navigation/native-stack
|
||||
```
|
||||
Or with npm
|
||||
|
||||
```sh
|
||||
npm install --save @react-navigation/native @react-navigation/native-stack
|
||||
```
|
||||
|
||||
If you are using Expo, to ensure that you get the compatible versions of the libraries, run:
|
||||
|
||||
```sh
|
||||
expo install react-native-screens
|
||||
```
|
||||
|
||||
If you are not using Expo, run the following:
|
||||
|
||||
```sh
|
||||
yarn add react-native-screens
|
||||
```
|
||||
Or with npm
|
||||
|
||||
```sh
|
||||
npm install --save react-native-screens
|
||||
```
|
||||
|
||||
If you are using Expo, you are done. Otherwise, continue to the next steps.
|
||||
|
||||
To complete the linking on iOS, make sure you have [Cocoapods](https://cocoapods.org/) installed. Then run:
|
||||
|
||||
```sh
|
||||
cd ios
|
||||
pod install
|
||||
cd ..
|
||||
```
|
||||
|
||||
To finalize installation of `react-native-screens` for Android, add the following two lines to dependencies section in `android/app/build.gradle`:
|
||||
|
||||
```gradle
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
|
||||
```
|
||||
|
||||
Make sure to enable `react-native-screens`. This needs to be done before our app renders. To do it, add the following code in your entry file (e.g. `App.js`):
|
||||
|
||||
```js
|
||||
import { enableScreens } from 'react-native-screens';
|
||||
|
||||
enableScreens();
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
|
||||
const Stack = createNativeStackNavigator();
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<Stack.Navigator>
|
||||
<Stack.Screen name="home" component={Home} options={{ title: 'Home' }} />
|
||||
<Stack.Screen name="feed" component={Feed} options={{ title: 'Feed' }} />
|
||||
<Stack.Screen
|
||||
name="profile"
|
||||
component={Profile}
|
||||
options={{ title: 'Profile' }}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
);
|
||||
}
|
||||
```
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/native-stack-navigator.html).
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
{
|
||||
"name": "@react-navigation/native-stack",
|
||||
"description": "Native stack navigator component for iOS and Android",
|
||||
"version": "5.0.0-alpha.32",
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-native",
|
||||
"react-navigation"
|
||||
],
|
||||
"version": "5.0.0-alpha.35",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/react-navigation/navigation-ex/tree/master/packages/native-stack",
|
||||
"repository": "https://github.com/react-navigation/react-navigation/tree/master/packages/native-stack",
|
||||
"bugs": {
|
||||
"url": "https://github.com/react-navigation/react-navigation/issues"
|
||||
},
|
||||
"homepage": "https://reactnavigation.org/docs/native-stack-navigator.html",
|
||||
"main": "lib/commonjs/index.js",
|
||||
"react-native": "src/index.tsx",
|
||||
"module": "lib/module/index.js",
|
||||
@@ -35,7 +39,7 @@
|
||||
"typescript": "^3.7.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-navigation/native": "^5.0.0-alpha.0",
|
||||
"@react-navigation/native": "^5.0.0",
|
||||
"react": "*",
|
||||
"react-native": "*",
|
||||
"react-native-screens": "^2.0.0-alpha.33"
|
||||
|
||||
Reference in New Issue
Block a user