From 8369370548a08b244e7f599b64b1eb8226805d7b Mon Sep 17 00:00:00 2001 From: xiaohaoyu123 Date: Mon, 20 May 2024 16:29:57 +0800 Subject: [PATCH] =?UTF-8?q?[Issues:=20#I9QP65]=20=E6=B7=BB=E5=8A=A0react-n?= =?UTF-8?q?avigation=E6=8C=87=E5=AF=BC=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/flipper-plugin-react-navigation.md | 60 +++++++ zh-cn/react-navigation-core.md | 129 +++++++++++++++ zh-cn/react-navigation-devtools.md | 74 +++++++++ .../react-navigation-material-bottom-tabs.md | 139 ++++++++++++++++ zh-cn/react-navigation-material-top-tabs.md | 136 ++++++++++++++++ zh-cn/react-navigation-routers.md | 149 ++++++++++++++++++ 6 files changed, 687 insertions(+) create mode 100644 zh-cn/flipper-plugin-react-navigation.md create mode 100644 zh-cn/react-navigation-core.md create mode 100644 zh-cn/react-navigation-devtools.md create mode 100644 zh-cn/react-navigation-material-bottom-tabs.md create mode 100644 zh-cn/react-navigation-material-top-tabs.md create mode 100644 zh-cn/react-navigation-routers.md diff --git a/zh-cn/flipper-plugin-react-navigation.md b/zh-cn/flipper-plugin-react-navigation.md new file mode 100644 index 00000000..5d7d3005 --- /dev/null +++ b/zh-cn/flipper-plugin-react-navigation.md @@ -0,0 +1,60 @@ +> 模板版本:v0.2.1 + +

+

flipper-plugin-react-navigation

+

+

+ + Supported platforms + + + License + +

+ +> [!TIP] [Github 地址](https://github.com/react-navigation/react-navigation/tree/6.x/packages/flipper-plugin-react-navigation) + +## 安装与使用 + +进入到工程目录并输入以下命令: + + + +#### **npm** + +```bash +npm install flipper-plugin-react-navigation@6.0.26 +``` + +#### **yarn** + +```bash +yarn add flipper-plugin-react-navigation@6.0.26 +``` + +此库是flipper插件库,需配合flipper App使用。下面的代码展示了这个库的基本使用场景,更多详情请参考[使用教程](https://github.com/react-navigation/react-navigation/tree/6.x/packages/flipper-plugin-react-navigation): + +编辑 `~/.flipper/config.json` (当 flipper 处于关闭状态) +```js +{ + "pluginPaths": ["/path/to/react-navigation/packages"] +} +``` +然后在 `flipper-plugin-react-navigation` 里运行 `yarn watch` + + +## 约束与限制 + +### 兼容性 + +本文档内容基于以下版本验证通过: + +1. RNOH:0.72.20; SDK:HarmonyOS NEXT Developer Beta1 B.0.18; IDE:DevEco Studio 5.0.3.200; ROM:3.0.0.18; + +## 遗留问题 + +## 其他 + +## 开源协议 + +本项目基于 [The MIT License (MIT)](https://github.com/react-navigation/react-navigation/blob/6.x/packages/flipper-plugin-react-navigation/LICENSE) ,请自由地享受和参与开源。 diff --git a/zh-cn/react-navigation-core.md b/zh-cn/react-navigation-core.md new file mode 100644 index 00000000..ca164978 --- /dev/null +++ b/zh-cn/react-navigation-core.md @@ -0,0 +1,129 @@ +> 模板版本:v0.2.1 + +

+

@react-navigation/core

+

+

+ + Supported platforms + + + License + +

+ +> [!TIP] [Github 地址](https://github.com/react-navigation/react-navigation/tree/6.x/packages/core) + +## 安装与使用 + +进入到工程目录并输入以下命令: + + + +#### **npm** + +```bash +npm install @react-navigation/core@6.4.16 +``` + +#### **yarn** + +```bash +yarn add @react-navigation/core@6.4.16 +``` + +[!TIP] 如果要体验全部demo效果,还需要安装以下依赖: +```bash +npm install @react-navigation/native@6.1.17 +npm install @react-navigation/stack@6.3.29 +``` + + + +下面的代码展示了这个库的基本使用场景: + +> [!WARNING] 使用时 import 的库名不变。 + +```js +import * as React from 'react'; +import { Button, View, Text } from 'react-native'; +import { NavigationContainer } from '@react-navigation/native'; +import { createStackNavigator } from '@react-navigation/stack'; +import { useNavigation } from '@react-navigation/core'; + +function MyBackButton() { + const navigation = useNavigation(); + + return ( +