Skip to content

Commit 83fbcb5

Browse files
docs(readme): update integration steps for Expo and fix minor issue in README (#88)
* docs(expo): update integration steps for Expo * docs(readme): fix minor typos and clarify code examples
1 parent 37d781a commit 83fbcb5

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

README.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ Use this SDK to add instant messaging capabilities to your application. By conne
44

55
The iOS SDK core is implemented in [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core). Using [gomobile](https://github.com/golang/mobile), it can be compiled into an XCFramework for iOS integration. iOS interacts with the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) through JSON, and the SDK exposes a re-encapsulated API for easy usage. In terms of data storage, iOS utilizes the SQLite layer provided internally by the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core).
66

7-
The android SDK core is implemented in [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core). Using [gomobile](https://github.com/golang/mobile), it can be compiled into an AAR file for Android integration. Android interacts with the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) through JSON, and the SDK exposes a re-encapsulated API for easy usage. In terms of data storage, Android utilizes the SQLite layer provided internally by the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core).
7+
The Android SDK core is implemented in [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core). Using [gomobile](https://github.com/golang/mobile), it can be compiled into an AAR file for Android integration. Android interacts with the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) through JSON, and the SDK exposes a re-encapsulated API for easy usage. In terms of data storage, Android utilizes the SQLite layer provided internally by the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core).
88

99
The React Native Client SDK uses the [NativeModule](https://reactnative.dev/docs/native-modules-intro) system to expose instances of Java/Objective-C classes to JavaScript (JS) as JS objects, thereby allowing you to execute arbitrary native code from within JS.
1010

1111
## Tips 🔔
1212

13-
1. Starting from `v3.8.3-patch.10`, the package name has been changed from `open-im-sdk-rn` to `@openim/rn-client-sdk`.
13+
1. **Expo support:** Expo custom dev client workflow is supported from `v3.8.3-patch.10.3` and later.
1414

15-
2. **operationID Parameter:** This parameter is used for backend log querying. Starting from `v3.8.3-patch.10.2`, the `operationID` parameter is optional for all APIs (the SDK will auto-generate one if not provided). For earlier versions, this parameter is required and must be passed explicitly.
15+
2. **Event Binding API:** Starting from `v3.8.3-patch.10.2`, you can use `OpenIMSDK.on()` to listen for events with better TypeScript type hints. Earlier versions must use the `OpenIMEmitter` object. Both approaches remain compatible with the latest version.
1616

17-
3. **Event Binding API:** Starting from `v3.8.3-patch.10.2`, you can use `OpenIMSDK.on()` to listen for events with better TypeScript type hints. Earlier versions must use the `OpenIMEmitter` object. Both approaches remain compatible with the latest version.
17+
3. **operationID Parameter:** This parameter is used for backend log querying. Starting from `v3.8.3-patch.10.2`, the `operationID` parameter is optional for all APIs (the SDK will auto-generate one if not provided). For earlier versions, this parameter is required and must be passed explicitly.
1818

19-
4. The `v3.5.1` contains ***significant disruptive updates***. If you need to upgrade, please check the incoming data and the returned data.
19+
4. Starting from `v3.8.3-patch.10`, the package name has been changed from `open-im-sdk-rn` to `@openim/rn-client-sdk`.
20+
21+
5. The `v3.5.1` contains ***significant disruptive updates***. If you need to upgrade, please check the incoming data and the returned data.
2022

2123
## Documentation 📚
2224

@@ -26,10 +28,31 @@ For the SDK reference, see [https://docs.openim.io/sdks/quickstart/reactNative](
2628

2729
## Installation 💻
2830

29-
### Adding Dependencies
31+
### Install with React Native CLI
3032

3133
```sh
32-
yarn add @openim/rn-client-sdk
34+
# install the SDK
35+
npm install @openim/rn-client-sdk
36+
37+
# iOS native dependencies
38+
cd ios && pod install && cd ..
39+
```
40+
41+
### Install with Expo
42+
43+
`v3.8.3-patch.10.3` and later support Expo via the custom development client (prebuild) workflow. This package bridges native modules, so Expo projects must run in a prebuild/custom development client workflow rather than Expo Go.
44+
45+
```sh
46+
# install the SDK
47+
npm install @openim/rn-client-sdk
48+
49+
# generate native projects and run
50+
npx expo prebuild
51+
npx expo run:android
52+
npx expo run:ios
53+
54+
# optional: Expo Go–like dev client experience
55+
npx expo install expo-dev-client
3356
```
3457

3558
## Usage 🚀
@@ -45,7 +68,6 @@ import RNFS from 'react-native-fs';
4568
RNFS.mkdir(RNFS.DocumentDirectoryPath + '/tmp');
4669

4770
OpenIMSDK.initSDK({
48-
platformID: 2, // 1: ios, 2: android
4971
apiAddr: 'http://your-server-ip:10002',
5072
wsAddr: 'ws://your-server-ip:10001',
5173
dataDir: RNFS.DocumentDirectoryPath + '/tmp',
@@ -158,7 +180,7 @@ OpenIMSDKRN.sendMessage({
158180

159181
## Examples 🌟
160182

161-
You can find a demo web app that use the SDK in the [openim-reactnative-demo](https://github.com/openimsdk/openim-reactnative-demo) repository.
183+
You can find a demo React-Native app that use the SDK in the [openim-reactnative-demo](https://github.com/openimsdk/openim-reactnative-demo) repository.
162184

163185
or:
164186

0 commit comments

Comments
 (0)