# nmrs-react-native **Repository Path**: yujiehao/nmrs-react-native ## Basic Information - **Project Name**: nmrs-react-native - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-21 - **Last Updated**: 2024-11-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 简介 - React Native [0.63](<(https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#v0630)>) 脚手架 - airstore 简化页面状态管理 - 使用 [React Hooks](https://reactjs.org/docs/hooks-intro.html) ## 依赖库 - [axios](https://github.com/mzabriskie/axios) request/response 拦截器添加access_token device_info等http请求header - react-navigation [5.0](https://reactnavigation.org) - react-native-keychain 用户名密码保存 - 登录密码加密 [crypto-js 3.3.0](https://github.com/brix/crypto-js) - react-native-vector-icons [矢量图标](https://oblador.github.io/react-native-vector-icons/) - `useStorage()` [async storage](http://www.yl-blog.com/article/671.html) - `useNetInfo()` [网络状态信息](https://github.com/react-native-community/react-native-netinfo) - `useTranslation()` i18n ### UI库 - 常用交互组件[ant design rn](https://rn.mobile.ant.design) - 表格[Table](https://github.com/Gil2015/react-native-table-component) ## 环境配置 - react native [安装步骤](https://www.reactnative.cn/docs/getting-started) - android studio [国内下载链接](https://developer.android.google.cn/studio) - windows * 设置 android studio 环境变量 - MacOS * appstore Xcode 11.0+ (react-native-webview [10.0+](https://github.com/react-native-community/react-native-webview/issues/1353)) * brew[国内安装](https://gitee.com/cunkai/HomebrewCN) [国内镜像安装](https://mirror.tuna.tsinghua.edu.cn/help/homebrew) ```sh /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" ``` * brew install cocoapods nodejs (rm -rf [cocoapods](https://www.jianshu.com/p/6daf17c1a0fc) npm等删除遗留安装) * brew link cocoapods ## 代码目录 ``` . +-- README.md // 当前说明 +-- package.json // node script rn dependencies 说明 +-- __tests__ // react jest测试文件 +-- android // 原生android +-- ios // 原生ios +-- index.js // 入口js +-- src | +-- App.js // RN应用根视图 | +-- constants // 常量定义 服务端url连接配置 | +-- i18n // 国际化i18n.js 语言json文件 | +-- rcomponents // 提取公共组件 | +-- services // AsyncStorage Geolocation ApiClient 自定义React Hooks等 | +-- navigation | | +-- appNavigation.js // App 导航入口 | | +-- loginStack.js // 登录导航Screens | | +-- tabStack.js // 底下首页/我的TAB导航配置 | | +-- homeStack.js // 各应用Screen导航配置 从screens/Home/routeConfig.js读取 | +-- screens | | +-- Home | | | +-- routeConfig.js // 各应用Screen定义用于 react-navigation配置生成 和 Home grid配置 | | +-- XXX // 各应用页面 | +-- stores | | +-- userStore // hasPermission判断页面权限是否满足 ``` ## 开始 **Step 1:** Clone and Install ```sh $ git clone https://git.loongair.cn/scm/nmrs/nmrs-mobile.git $ cd nmrs-mobile $ npm install ``` **Step 2:** 启动 ```sh $ npm start --reset-cache $ npm run android 或 $ npm run ios ``` ### ios 运行/打包 - cd ios | pod install - [打包脚本](https://github.com/zhaozhiming/zhaozhiming.github.com/blob/source/source/_posts/2019-02-15-react-native-app-auto-build-process.markdown) | [xcode archive](https://www.devio.org/2020/03/15/React-Native-releases-packaged-iOS-apps-for-apps/) ``` sh npm run ios:build ``` ### ANDROID打包 参见 [APK 签名发布](https://www.devio.org/2019/11/08/react-native-Release-APP-Signature-Package-APK) jdk/bin keytool(https://reactnative.cn/docs/signed-apk-android) - keytool -genkeypair -v -keystore gjmobile.keystore -alias gjmobile -keyalg RSA -keysize 2048 -validity 10000 - apk生成目录 android/app/build/outputs/apk/release ``` sh npm run android:release:win ``` ## Bugs? Comments? Features? happily welcomed! * :wrench: Create Fixes, suggest new features or update docs ## 其他参考资料 - sql数据库 [存储](https://github.com/hsjoberg/blixt-wallet) - webview 获取[cookies](https://dev.to/safaiyeh/react-native-authentication-with-webview-1nh) - ui库 * https://dev.to/serkanbektas/top-react-native-ui-libraries-you-should-know-dg9 * https://callstack.github.io/react-native-paper/showcase.html - 原生SDK调用 * https://github.com/petterh/react-native-android-activity * https://github.com/chicio/React-Native-Native-Modules-Communication * https://stackoverflow.com/questions/36265725/calling-a-android-native-ui-component-method-from-react-native-js-code * https://stackoverflow.com/questions/32704336/how-to-access-activity-from-a-react-native-android-module * https://stackoverflow.com/questions/61717148/application-tried-to-present-a-nil-modal-view-controller-on-target-in-react-nati * https://github.com/neuberoliveira/react-native-gps-state https://github.com/johniak/react-native-root-view-background