Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Latest commit

 

History

History
226 lines (165 loc) · 7.23 KB

DOCUMENT.md

File metadata and controls

226 lines (165 loc) · 7.23 KB

Upgrade CLI

npm uninstall -g react-native-cli
npm i -g @react-native-community/cli

Init

# react-native init surmon_me_native --template react-native-template-typescript
git clone git@github.com:surmon-china/surmon.me.native.git

# Install dependencies
rm -rf node_modules/
yarn

# Sentry
yarn sentry-wizard -i reactNative -p ios android

# IOS
cd ios && pod install && cd ..

# Android
# https://reactnavigation.org/docs/getting-started/#installing-dependencies-into-a-bare-react-native-project

# Link assets
react-native link

# Now you can run the app on development environment

Run

# 编译 IOS 并开启服务器
yarn ios

# 编译 Android 并开启服务器
yarn android

# 指定设备
yarn <platform> --device "Surmon’s iPhone 18 pro"

# 清除缓存并开启服务器(不执行客户端)
yarn start

# 编译两端并开启服务器
yarn all

# 测试
yarn lint
yarn test

Relase

First step (update versions): yarn postversion

Android

# generate app-release-key.keystore

# Build Android apk -> (Sentry auto upload map)
yarn release:android

# output: android/app/build/outputs/apk/release/app-release.apk
cp -f ./android/app/build/outputs/apk/release/app-release.apk ./dist/android/surmon.me.apk

IOS

Build IOS -> XCode -> (Sentry auto upload map)

  1. XCode -> Product -> Schema -> Edit Schema
  2. Build Config: select relase & debug executable = false
  3. Select your device & Press Run

Bundle

bundle normal

Android:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/main.jsbundle --assets-dest android/app/src/main/res/

IOS:

react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ./ios/main.jsbundle --assets-dest ./ios/bundle

bundle source-map to dist dir

Android:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output dist/android/index.android.bundle --sourcemap-output dist/android/index.android.bundle.map

IOS:

react-native bundle --platform ios --dev false --entry-file index.js --bundle-output dist/ios/index.ios.bundle --sourcemap-output dist/ios/index.ios.bundle.map

manual upload sentry source-map

export SENTRY_PROPERTIES=./android/.sentry.properties
node ./sentry.js

Issues

Unrecognized font family 'DIN-Regular'
react-native link

Links

Sentry.io for react-native

  1. yarn add @sentry/react-native
  2. yarn sentry-wizard -i reactNative -p ios android
  3. cd ios && pod install

Update version

  • yarn postversion
  • build.gradle
  • info.plist

无障碍支持(accessibility):

启动屏:

App icon

Display name

  • ios: /ios/surmon_me/Info.plist:CFBundleDisplayName
  • android: android/app/src/main/res/values/strings.xml
IOS
Android

业务结构

  • assets
    • 静态资源(字体、图片)
  • types
    • 被公共消费的任何类型扩展
  • constants
    • 被公共消费的任何直接量
  • languages
    • i18n 语言包
  • style
    • 类似 Web 平台的 CSS 集合,包含字体、颜色、尺寸、混入
  • services
    • 所有会产生(数据、UI)IO 的数据交互接口
  • utils
    • 不发生 IO 行为的所有工具性质的 pure function
  • components
    • 所有公共组件(全局、局部、布局)
  • pages
    • 所有被导航器消费的页面级组件
  • stores
    • 全局性质的公共 store
  • config
    • App 全局配置
  • routes
    • App 路由表(枚举量)
  • index
    • 不涉及 UI 风格的导航栈实例及配置

设计细节