|
2 | 2 |
|
3 | 3 | 一个基于 [uiw/react-native](https://github.com/uiwjs/react-native-uiw) 的 React Native 模板。 |
4 | 4 |
|
| 5 | + |
| 6 | +## 特性 |
| 7 | + |
| 8 | +该模板包括以下内容: |
| 9 | + |
| 10 | +1. 直接优雅地使用 [React Native CLI](https://github.com/react-native-community/cli) |
| 11 | +1. 支持 [React Native](https://github.com/facebook/react-native) 0.60 (现在有了 Hooks 🙌) |
| 12 | +1. 易于使用和理解的文件夹结构,让您尽快启动和运行 |
| 13 | +1. [@uiw/react-native](https://github.com/uiwjs/react-native-uiw) 组件框架和主题 |
| 14 | +1. 使用 [react-navigation](https://github.com/react-navigation/react-navigation) 来路由和导航您的 React Native 应用程序 |
| 15 | +1. 支持 [Redux](https://github.com/reduxjs/redux) (以 [@rematch](https://github.com/rematch/rematch) 为例) |
| 16 | +1. [ESLint](https://github.com/eslint/eslint), 和 [Prettier](https://github.com/prettier/prettier) 开箱即用 |
| 17 | +1. 使用 [mocker-api](https://github.com/jaywcjlove/mocker-api) 创建模拟的 REST API |
| 18 | + |
5 | 19 | ## 安装与使用 |
6 | 20 |
|
7 | 21 | 🚧 此模板仅适用于新的 CLI。 此模板适用于 >= 0.61 的 React Native 版本。 它没有用以前的版本进行测试。 |
@@ -108,53 +122,4 @@ npm run ios |
108 | 122 | ├── .eslintrc # eslint configuration |
109 | 123 | ├── index.js # app entry file |
110 | 124 | └── package.json # This document is all you need to know about what’s required in your package.json file. |
111 | | -``` |
112 | | -## 新增页面 |
113 | | - |
114 | | -在 src / pages 下创建新的 js 文件。 如果有多个相关页面,您可以创建一个新文件夹来放置相关文件 |
115 | | -```bash |
116 | | -src |
117 | | - models |
118 | | - pages |
119 | | -+ NewPage |
120 | | -+ index.js |
121 | | - ... |
122 | | -... |
123 | | -package.json |
124 | | -``` |
125 | | - |
126 | | -为了更好的演示,我们初始化NewPage/index.js的内容如下: |
127 | | -```jsx |
128 | | -import React, {Component} from 'react'; |
129 | | -import {View, Text, SafeAreaView} from 'react-native'; |
130 | | - |
131 | | -export default class MyNewPage extends Component { |
132 | | - render() { |
133 | | - return ( |
134 | | - <SafeAreaView> |
135 | | - <View> |
136 | | - <Text>我的</Text> |
137 | | - </View> |
138 | | - </SafeAreaView> |
139 | | - ); |
140 | | - } |
141 | | -} |
142 | | -``` |
143 | | -将文件加入菜单和路由 |
144 | | -在 src / routes 下homeTab.js中使用 component 配置我们页面到路由中 |
145 | | -```jsx |
146 | | -import MyNewPage from '../pages/NewPage'; |
147 | | - |
148 | | -export const stackPageData = [ |
149 | | - { |
150 | | - name: 'MyNewPage', |
151 | | - component: MyNewPage, |
152 | | - options: { |
153 | | - title: '我的', |
154 | | - }, |
155 | | - }, |
156 | | -]; |
157 | | -``` |
158 | | -路由配置完成后,访问页面即可看到效果,如需要配置 `title`,`tabBarIcon`,`header`等更多设置可以在这里找到[React Navigation](https://reactnavigation.org/docs/stack-navigator/) |
159 | | - |
160 | | -如此回到之前新建的 NewPage.js,可以开始写业务代码了! |
| 125 | +``` |
0 commit comments