- Android: correct version header 0.5.x→0.4.x, add sdk-license to module table, update artifact versions to 0.4.10 - iOS: correct min version iOS 14→16, bump version to 0.2.0, update SPM ref to from: "0.2.0" - RN: fix version 0.3.x→0.2.x, standardize npm registry URL, add @xuqm/rn-license to module table - Flutter: update git ref to v0.2.2, add xuqm_flutter_license to module tables - Add new docs: ios/license, rn/push, rn/license, flutter/push, flutter/update, flutter/license - tenant-platform: make appKey a computed ref in Push/VersionManagementView to fix service gating reactivity on route change - tenant-platform: add requestActivation API endpoint - tenant-platform: add IM service gating UI (checkServiceEnabled + activation dialog) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
112 行
2.2 KiB
Markdown
112 行
2.2 KiB
Markdown
# React Native 安装配置
|
||
|
||
**包名**:`@xuqm/rn-sdk` · **版本**:0.2.x · **RN 版本**:≥ 0.76.0
|
||
|
||
> `rn-sdk` 作为内部基础包存在,业务方正常接入时使用 `@xuqm/rn-common` 和各业务模块即可。
|
||
|
||
---
|
||
|
||
## npm / yarn 安装
|
||
|
||
在项目根目录创建 `.npmrc`:
|
||
|
||
```
|
||
@xuqm:registry=https://nexus.xuqinmin.com/repository/npm-hosted/
|
||
```
|
||
|
||
只使用基础能力时,直接安装 `rn-common`:
|
||
|
||
```bash
|
||
yarn add @xuqm/rn-common
|
||
```
|
||
|
||
按需安装模块时,`rn-im` / `rn-push` / `rn-update` 都会自动带上 `rn-common` 和 `rn-sdk`:
|
||
|
||
```bash
|
||
yarn add @xuqm/rn-common @xuqm/rn-im
|
||
# 或全量安装
|
||
yarn add @xuqm/rn-common @xuqm/rn-im @xuqm/rn-push @xuqm/rn-update
|
||
```
|
||
|
||
---
|
||
|
||
## 自动 / 手动链接
|
||
|
||
React Native 0.60+ 支持**自动链接**,安装后执行:
|
||
|
||
```bash
|
||
cd ios && pod install
|
||
```
|
||
|
||
> 若使用 Expo,需先执行 `expo prebuild` 生成原生项目后再执行 `pod install`。
|
||
|
||
---
|
||
|
||
## iOS 配置
|
||
|
||
### Pod 安装
|
||
|
||
```bash
|
||
cd ios
|
||
pod install
|
||
```
|
||
|
||
### 权限声明
|
||
|
||
在 `Info.plist` 中添加:
|
||
|
||
```xml
|
||
<key>NSCameraUsageDescription</key>
|
||
<string>需要访问相机</string>
|
||
<key>NSPhotoLibraryUsageDescription</key>
|
||
<string>需要访问相册</string>
|
||
<key>NSMicrophoneUsageDescription</key>
|
||
<string>需要访问麦克风</string>
|
||
```
|
||
|
||
---
|
||
|
||
## Android 配置
|
||
|
||
### Gradle 仓库
|
||
|
||
在 `android/build.gradle` 中确保包含:
|
||
|
||
```gradle
|
||
allprojects {
|
||
repositories {
|
||
maven { url "https://nexus.xuqinmin.com/repository/android/" }
|
||
google()
|
||
mavenCentral()
|
||
}
|
||
}
|
||
```
|
||
|
||
### 最低版本
|
||
|
||
- `minSdkVersion = 24`
|
||
- `compileSdkVersion = 34`
|
||
|
||
---
|
||
|
||
## 依赖关系
|
||
|
||
```
|
||
@xuqm/rn-sdk(meta-package,不建议业务方直接引用)
|
||
├── @xuqm/rn-common ← 初始化、网络、设备信息
|
||
├── @xuqm/rn-im ← IM 模块(依赖 WatermelonDB)
|
||
├── @xuqm/rn-push ← Push 模块
|
||
├── @xuqm/rn-update ← 更新模块
|
||
└── @xuqm/rn-license ← 授权管理模块(依赖 react-native-quick-crypto)
|
||
```
|
||
|
||
---
|
||
|
||
## 下一步
|
||
|
||
- [RN IM 接入 →](./im)
|
||
- [RN 群聊 →](./group)
|
||
- [RN 推送接入 →](./push)
|
||
- [RN 版本更新 →](./update)
|
||
- [RN 授权管理 →](./license)
|