tencent cloud

Chat

React Native

Download
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-08-10 14:41:00
chat-uikit-react-native is a React Native UI component library based on Tencent Cloud Chat SDK. It provides universal UI components, including conversation, chat, and group features. With these well-designed UI components, you can quickly build elegant, reliable, and scalable chat applications. The UIKit interface developed with React Native is more in line with the usage habits of overseas customers and supports internationalization. If your business needs to expand overseas, you are welcome to integrate it. For details, refer to the open source code.
The interface effect of chat-uikit-react-native is shown below:


Prerequisites

Step1:Activate the Service

Log in to the Chat console, click Create Application. If you have an existing application, you can omit the application creation process.



Enter the application name in the create pop-up window and choose Chat, select the appropriate Deployment Region, then click Create.




Step2:Obtain the SDKAppID and SecretKey

On the Chat Product Details, obtain the SDKAppID and SecretKey information from the SDKAppID column.
Note:
View key info requires identity verification.
Key information is sensitive information. To prevent misappropriation, keep it safe and guard against leakage.




Step3:Create a test account

Log in to the Chat > Users, create 2–3 test accounts for experience in C2C chat and group chat capacities.




Development Environment Requirement

React Native version: ≥ 0.85.3
Node.js version: ≥ 22
iOS version:≥ iOS 16.0
Android version:≥ 24
If you are developing a React Native project for the first time, please refer to the steps on the React Native official website set-up-your-environment to configure your development environment.
If you encounter any environment issues during project creation or compilation, you can run npx react-native doctor for an environmental diagnosis.

Download the Demo

git clone https://github.com/TencentCloud/chat-demo-react-native
cd chat-demo-react-native/Demo
Install Using npm
npm i --legacy-peer-deps

Configure the Demo

Set SDKAPPID and SECRETKEY in the src/screens/LoginScreen.tsx file, which can be obtained from the Chat Console.
const SDKAppID = 0; // number
const SECRETKEY = 'xxx'; // string

Run Demo

To compile and run the project, you need to use a real device or an emulator. It is recommended to use a real device. You can refer to the React Native official website running-on-device for connecting a real device for debugging.
Android
iOS
1. Enable Developer Mode on the phone and turn on the USB Debugging switch.
2. Connect the phone with a USB cable, it is recommended to choose the Transferring File option, do not choose the Charge Only option.
3. After confirming the phone is successfully connected, execute npm run android to compile and run the project.
npm run android
1. Connect the phone with a USB cable and open the project ios directory with Xcode.
2. Configure the signing information according to the running-on-device section on the React Native official website.
3. Go to the ios directory and install dependencies.
cd ios
pod install
4. Go back to the root directory and execute npm run ios to compile and run the project.
cd ../
npm run ios

Send Your First Message

Log in to the app: Enter the test account created in Prerequisites > Activate Service > Step 3: Create Test Account on the login page, then select a chat scenario after logging in.
Add a friend: Tap "Contacts," enter the userID of another test account (created in Prerequisites > Activate Service > Step 3: Create Test Account) into the search box, and complete the process of adding the friend.
Start a conversation: Tap the friend's information to view their details, then tap "Send Message" to enter the chat interface and send your first message.


FAQ

If you encounter an error as shown in the figure when running npm run android, please reset the environment variables in the project root directory.


export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools

If you encounter node environment variable issues when executing the Build command in Xcode, please follow these steps:


cd ios
echo export NODE_BINARY=$(command -v node) > .xcode.env

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백