Browse SDKs · React Native
SDKsReact Native

Environment-specific implementation

Install the OpenIM React Native SDK in a React Native CLI project or an Expo custom development client.

Copy

This page covers the dependency and native project configuration required by a React Native application.

Add the dependency

Install in a React Native CLI project

Install the OpenIM React Native SDK from the project root:

npm install @openim/rn-client-sdk
cd ios && pod install && cd ..

You can use equivalent commands with your project's package manager. After installation, build both the Android and iOS projects to confirm that the native module is linked correctly.

Install in an Expo project

The OpenIM React Native SDK contains Android and iOS native modules, which are not included in Expo Go. Install the SDK, use expo prebuild --clean to generate or update the native projects from the Expo configuration, and then build a custom development client:

npm install @openim/rn-client-sdk
npx expo prebuild --clean
npx expo run:android
npx expo run:ios

After changing the Expo configuration or adding a dependency that requires native support, run expo prebuild --clean again and rebuild the development client. You can install expo-dev-client for an Expo-oriented development client experience, but the runtime still uses a custom development client rather than Expo Go.

Verify the native environment

After installing the dependency and configuring the native projects, build the Android and iOS applications and confirm that the SDK native module compiles and loads.

Next step