智慧社区原生项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.0 KiB

3 years ago
# Taro Native Shell
3 years ago
参考文档:[Taro React Native 端开发流程 - 分离模式](https://docs.taro.zone/docs/react-native#%E5%88%86%E7%A6%BB%E6%A8%A1%E5%BC%8F)
3 years ago
Taro 原生 React Native 壳工程,和 React Native init 的工程的区别如下:
3 years ago
0. 集成了 [expo](https://docs.expo.dev/bare/installing-expo-modules/)
1. 集成了 Taro 依赖的所有原生库
2. debug 方式变更: 在 JS 工程中 `yarn dev:rn` 启动 metro server
3. release 方式变更: 在 JS 工程中 `yarn buid:rn` 打包 jsbundle 并通过配置 `rn.output` 输出到壳工程
3 years ago
## 该仓库如何生成
3 years ago
1. 使用 `react-native` [初始化项目](https://reactnative.dev/docs/environment-setup)
```
3 years ago
npx react-native init taroDemo --version 0.73.0
```
3 years ago
2. 使用 `expo-cli` [自动安装 expo](https://docs.expo.dev/bare/installing-expo-modules/#automatic-installation)
3 years ago
```
npx install-expo-modules@latest
```
3 years ago
3. 修改部分代码以支持 Taro,此部分可以直接 cherry-pick
- [scripts] 修改 `android`, `ios` 脚本,增加 `upgradePeerdeps` 脚本
- [devDependencies] 增加 `install-peerdeps``pod-install`
- [ios] 添加相关 APP 权限说明
- [ios] 使用亮色主题
- [android] 添加国内 maven 源
- [android] 添加 gif 支持
- [android] 注释原 react native 打包
- [android] 使用亮色主题
- [docs] 复制该 `README.md` 文件
- [license] 复制 LICENSE 文件
3 years ago
4. 更新 Taro 需要的依赖(如果还没正式发布,则使用对应的 alpha 或 beta 版本)
3 years ago
```
yarn
yarn upgradePeerdeps
```
5. 添加打包脚本,此部分可以直接 cherry-pick
- [fastlane] 添加 Android、iOS fastlane 配置
- [actions] 添加 Android、iOS 打包脚本
- [ios] 添加默认图标
- [ios] 添加 ITSAppUsesNonExemptEncryption false
- [ios] 添加 main.jsbundle assets 引用
3 years ago
## React Native 小版本更新
3 years ago
https://react-native-community.github.io/upgrade-helper/
3 years ago
## Taro 版本更新
3 years ago
> 使用 Taro 最新版,或者修改 `upgradePeerdeps` 指定 Taro 版本,再执行:
```
yarn upgradePeerdeps
```