Here we provide you with a sample application to experience ZEGOCLOUD's In-app Chat, and also describe how to run the sample code with React Native.
For SDK 2.3.0
or later, the AppSign authentication mode and Token-based authentication mode are both supported.
If you want to change your authentication mode, please refer to the Upgrade the authentication mode from using the AppSign to Token.
The following structure shows the subdirectory structure of the In-app Chat sample code:
react-native
├── App.js
├── Gemfile
├── __tests__
├── android
├── app.json
├── babel.config.js
├── index.js
├── ios
├── main.js
├── metro.config.js
├── package-lock.json
├── package.json
├── react-native.config.js
├── src
│ ├── assets
│ │ └── js
│ │ ├── config.js
│ ├── components
│ ├── hooks
│ │ └── zim.js
│ └── pages
│ ├── action
│ ├── chat
│ ├── group
│ ├── home
│ └── login
├───────
In Visual Studio Code, import the sample code package file.
Modify the config.js
file under the src/assets/js
folder with the AppID and AppSign that you get in the Prerequisites steps.
export const appConfig = {
appID: , // Fill in the AppID you get.
appSign: , // Fill in the AppSign you get.
};
If your project uses the "Token-based authentication mode", please go to the ZEGOCLOUD Admin Console to get a temporary Token for debugging.
Enter the root directory of the project, and run the yarn install
to install dependencies. (for iOS devices, run the pod install
command instead.)
If running the program on an iOS device, please navigate to the root directory of the project and execute the command cd ios && pod install
to install dependencies.
In the root directory, run the yarn ios
or the yarn android
command to run the sample code.