Skip to content

Commit 9b64ef8

Browse files
feat: update the documentation for the react-native sdk v3.8.3-patch.12.3 (#294)
* feat: refine React Native quickstart, improve installation section wording for React Native CLI and Expo * fix: correct react-native SDK params for `createFaceMessage` and `getAdvancedHistoryMessageList`
1 parent 55a1b80 commit 9b64ef8

6 files changed

Lines changed: 82 additions & 30 deletions

File tree

docs/sdks/api/message/createFaceMessage.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ OIMMessageInfo *message = [OIMMessageInfo createFaceMessageWithIndex:0 data:@""]
140140
```ts showLineNumbers
141141
IMSDK.createFaceMessage({
142142
index: number;
143-
dataStr: string;
143+
data: string;
144144
}, operationID?: string): Promise<WsResponse<MessageItem>>
145145
```
146146

@@ -149,7 +149,7 @@ IMSDK.createFaceMessage({
149149
| 参数名称 | 参数类型 | 是否必填 | 描述 |
150150
| -------- | -------- | -------- | ---- |
151151
| index | number || 索引 |
152-
| dataStr | string || 内容 |
152+
| data | string || 内容 |
153153

154154
### 返回结果
155155

@@ -174,7 +174,7 @@ const IMSDK = getSDK();
174174

175175
IMSDK.createFaceMessage({
176176
index: 0,
177-
dataStr: 'https://xxx/xxx/xx.png',
177+
data: 'https://xxx/xxx/xx.png',
178178
})
179179
.then(({ data }) => {
180180
// 调用成功
@@ -240,7 +240,7 @@ IMSDK.asyncApi('createFaceMessage', IMSDK.uuid(), {
240240
```ts showLineNumbers
241241
OpenIMSDK.createFaceMessage({
242242
index: number;
243-
dataStr: string;
243+
data: string;
244244
}, operationID?: string): Promise<MessageItem>
245245
```
246246

@@ -249,7 +249,7 @@ OpenIMSDK.createFaceMessage({
249249
| 参数名称 | 参数类型 | 是否必填 | 描述 |
250250
| ----------- | -------- | -------- | ------------------------------------------------------- |
251251
| index | number || 索引 |
252-
| dataStr | string || 内容 |
252+
| data | string || 内容 |
253253
| operationID | string || 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 |
254254

255255
### 返回结果
@@ -267,7 +267,7 @@ import OpenIMSDK from "@openim/rn-client-sdk";
267267

268268
OpenIMSDK.createFaceMessage({
269269
index: 0,
270-
dataStr: 'https://xxx/xxx/xx.png',
270+
data: 'https://xxx/xxx/xx.png',
271271
})
272272
.then((data) => {
273273
// 调用成功

docs/sdks/api/message/getAdvancedHistoryMessageList.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,10 @@ IMSDK.asyncApi('getAdvancedHistoryMessageList', IMSDK.uuid(), {
275275

276276
```ts showLineNumbers
277277
OpenIMSDK.getAdvancedHistoryMessageList({
278-
lastMinSeq: number;
279-
count: number;
280-
startClientMsgID: string;
281278
conversationID: string;
279+
startClientMsgID: string;
280+
count: number;
281+
viewType: ViewType
282282
}, operationID?: string): Promise<AdvancedGetMessageResult>
283283
```
284284

@@ -302,13 +302,13 @@ OpenIMSDK.getAdvancedHistoryMessageList({
302302
### 代码示例
303303

304304
```js showLineNumbers
305-
import OpenIMSDK from "@openim/rn-client-sdk";
305+
import OpenIMSDK, { ViewType } from "@openim/rn-client-sdk";
306306

307307
OpenIMSDK.getAdvancedHistoryMessageList({
308-
lastMinSeq: 0,
309-
count: 20,
310-
startClientMsgID: '',
311308
conversationID: 'conversationID',
309+
startClientMsgID: '',
310+
count: 20,
311+
viewType: ViewType.History,
312312
})
313313
.then((data) => {
314314
// 调用成功

docs/sdks/quickstart/reactNative.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ sidebar_position: 4
99

1010
## 注意事项 ❗️
1111

12+
- **Android 16KB 页大小支持:**`v3.8.3-patch.12` 开始,Android 核心依赖升级为 `io.openim:core-sdk:3.8.3-patch12+1`,新增了对使用 16KB 内存页大小设备的兼容性。
13+
14+
- **Expo 支持:**`v3.8.3-patch.10.3` 及之后版本开始支持 Expo 的 development build(custom dev client)。
15+
1216
-`v3.8.3-patch.10` 版本开始,包名从 `open-im-sdk-rn` 改为 `@openim/rn-client-sdk`
1317

1418
-`v3.8.3-patch.10.2` 版本开始,`operationID` 参数是可选的(如果未提供,SDK 将自动生成一个),在之前的版本,这个参数是必填的,必须显式传递。(operationID 用于后端日志查询)
@@ -21,8 +25,31 @@ sidebar_position: 4
2125

2226
### 1. 添加依赖
2327

28+
#### 在 React Native CLI 项目中安装
29+
2430
```sh
25-
yarn add @openim/rn-client-sdk
31+
# 安装 openim sdk
32+
npm install @openim/rn-client-sdk
33+
34+
# 安装 iOS 依赖
35+
cd ios && pod install && cd ..
36+
```
37+
38+
#### 在 Expo 项目中安装
39+
40+
`v3.8.3-patch.10.3` 及之后版本支持 Expo。由于该包桥接了原生模块,因此需要使用 development build(custom dev client),不支持 Expo Go。
41+
42+
```sh
43+
# 安装 openim sdk
44+
npm install @openim/rn-client-sdk
45+
46+
# 生成原生工程并运行
47+
npx expo prebuild
48+
npx expo run:android
49+
npx expo run:ios
50+
51+
# 可选:安装 Expo 开发客户端
52+
npx expo install expo-dev-client
2653
```
2754

2855
### 2. 初始化 SDK
@@ -34,7 +61,6 @@ import RNFS from 'react-native-fs';
3461
RNFS.mkdir(RNFS.DocumentDirectoryPath + '/tmp');
3562

3663
OpenIMSDK.initSDK({
37-
platformID: 2, // 1: ios, 2: android
3864
apiAddr: 'http://your-server-ip:10002',
3965
wsAddr: 'ws://your-server-ip:10001',
4066
dataDir: RNFS.DocumentDirectoryPath + '/tmp',

i18n/en/docusaurus-plugin-content-docs-sdks/current/api/message/createFaceMessage.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ OIMMessageInfo *message = [OIMMessageInfo createFaceMessageWithIndex:0 data:@""]
140140
```ts showLineNumbers
141141
IMSDK.createFaceMessage({
142142
index: number;
143-
dataStr: string;
143+
data: string;
144144
}, operationID?: string): Promise<WsResponse<MessageItem>>
145145
```
146146

@@ -149,7 +149,7 @@ IMSDK.createFaceMessage({
149149
| Parameter Name | Parameter Type | Required | Description |
150150
| -------- | -------- | -------- | ---- |
151151
| index | number | Yes | Index |
152-
| dataStr | string | Yes | Content |
152+
| data | string | Yes | Content |
153153

154154
### Return Result
155155

@@ -174,7 +174,7 @@ const IMSDK = getSDK();
174174

175175
IMSDK.createFaceMessage({
176176
index: 0,
177-
dataStr: 'https://xxx/xxx/xx.png',
177+
data: 'https://xxx/xxx/xx.png',
178178
})
179179
.then(({ data }) => {
180180
// Call successful
@@ -240,7 +240,7 @@ IMSDK.asyncApi('createFaceMessage', IMSDK.uuid(), {
240240
```ts showLineNumbers
241241
OpenIMSDK.createFaceMessage({
242242
index: number;
243-
dataStr: string;
243+
data: string;
244244
}, operationID?: string): Promise<MessageItem>
245245
```
246246

@@ -249,7 +249,7 @@ OpenIMSDK.createFaceMessage({
249249
| Parameter Name | Parameter Type | Required | Description |
250250
| ----------- | -------- | -------- | ------------------------------------------------------- |
251251
| index | number | Yes | Index |
252-
| dataStr | string | Yes | Content |
252+
| data | string | Yes | Content |
253253
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
254254

255255
### Return Result
@@ -267,7 +267,7 @@ import OpenIMSDK from "@openim/rn-client-sdk";
267267

268268
OpenIMSDK.createFaceMessage({
269269
index: 0,
270-
dataStr: 'https://xxx/xxx/xx.png',
270+
data: 'https://xxx/xxx/xx.png',
271271
})
272272
.then((data) => {
273273
// Call successful

i18n/en/docusaurus-plugin-content-docs-sdks/current/api/message/getAdvancedHistoryMessageList.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,10 @@ IMSDK.asyncApi('getAdvancedHistoryMessageList', IMSDK.uuid(), {
275275

276276
```ts showLineNumbers
277277
OpenIMSDK.getAdvancedHistoryMessageList({
278-
lastMinSeq: number;
279-
count: number;
280-
startClientMsgID: string;
281278
conversationID: string;
279+
startClientMsgID: string;
280+
count: number;
281+
viewType: ViewType
282282
}, operationID?: string): Promise<AdvancedGetMessageResult>
283283
```
284284

@@ -302,13 +302,13 @@ OpenIMSDK.getAdvancedHistoryMessageList({
302302
### Code Example
303303

304304
```js showLineNumbers
305-
import OpenIMSDK from "@openim/rn-client-sdk";
305+
import OpenIMSDK, { ViewType } from "@openim/rn-client-sdk";
306306

307307
OpenIMSDK.getAdvancedHistoryMessageList({
308-
lastMinSeq: 0,
309-
count: 20,
310-
startClientMsgID: '',
311308
conversationID: 'conversationID',
309+
startClientMsgID: '',
310+
count: 20,
311+
viewType: ViewType.History,
312312
})
313313
.then((data) => {
314314
// Call successful

i18n/en/docusaurus-plugin-content-docs-sdks/current/quickstart/reactNative.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ We strongly recommend running our framework-specific [DEMO](https://github.com/o
99

1010
## Important Notes ❗️
1111

12+
- **Android 16KB page-size support:** Starting from `v3.8.3-patch.12`, the Android core dependency is upgraded to `io.openim:core-sdk:3.8.3-patch12+1`, adding compatibility for devices using 16KB memory page size.
13+
14+
- **Expo support:** Expo development build (custom dev client) is supported from `v3.8.3-patch.10.3` and later.
15+
1216
- Starting from version `v3.8.3-patch.10`, the package name changed from `open-im-sdk-rn` to `@openim/rn-client-sdk`.
1317

1418
- Starting from version `v3.8.3-patch.10.2`, the `operationID` parameter is optional (if not provided, the SDK will auto-generate one). In earlier versions, this parameter was required and had to be passed explicitly. (operationID is used for backend log queries)
@@ -21,8 +25,31 @@ We strongly recommend running our framework-specific [DEMO](https://github.com/o
2125

2226
### 1. Add Dependency
2327

28+
#### Install with React Native CLI
29+
2430
```sh
25-
yarn add @openim/rn-client-sdk
31+
# install the SDK
32+
npm install @openim/rn-client-sdk
33+
34+
# iOS native dependencies
35+
cd ios && pod install && cd ..
36+
```
37+
38+
#### Install with Expo
39+
40+
`v3.8.3-patch.10.3` and later support Expo. Because this package bridges native modules, you must use a development build (custom dev client); Expo Go is not supported.
41+
42+
```sh
43+
# install the SDK
44+
npm install @openim/rn-client-sdk
45+
46+
# generate native projects and run
47+
npx expo prebuild
48+
npx expo run:android
49+
npx expo run:ios
50+
51+
# optional: Expo Go–like dev client experience
52+
npx expo install expo-dev-client
2653
```
2754

2855
### 2. Initialize SDK
@@ -34,7 +61,6 @@ import RNFS from 'react-native-fs';
3461
RNFS.mkdir(RNFS.DocumentDirectoryPath + '/tmp');
3562

3663
OpenIMSDK.initSDK({
37-
platformID: 2, // 1: iOS, 2: Android
3864
apiAddr: 'http://your-server-ip:10002',
3965
wsAddr: 'ws://your-server-ip:10001',
4066
dataDir: RNFS.DocumentDirectoryPath + '/tmp',

0 commit comments

Comments
 (0)