NetEase Yunxin React Native SDK

NetEase Yunxin React Native SDK

react-native-netease-im .NetEase Yunxin React Native SDK


NetEase Yunxin React Native SDK


npm install @kangfenmao/react-native-netease-im


import { NeteaseIm } from "@kangfenmao/react-native-netease-im"

For detailed usage, please refer to App.tsx


  1. Add an initialization method to the project entry index.js
import { NeteaseIm } from "@kangfenmao/react-native-netease-im"

NeteaseIm.init("appKey", "apnsCername")

Note: The second parameter is the iOS push certificate name, which can be an empty string

  1. Android system also need to onCreateadd initialization methods of
import com.kangfenmao.nim.NeteaseIm;

public void onCreate() {
  // ...
  NeteaseIm.init(this, "appKey");


const listeners: EmitterSubscription[] = []

listeners . push ( 
  // Connection status changed 
  NeteaseImEvent . addListener ( 'onConnectStatusChanged' ,  ( event : ConnectStatus )  => 
    console . log ( event ) 
  ) , 
  // Received a message 
  NeteaseImEvent . addListener ( 'onMessages' ,  ( messages : NIM . Message [] )  => 
    console . log ( messages ) 
  ) , 
  // Conversation list update 
  NeteaseImEvent . addListener ( 'onConversationsChanged' ,  ( conversations : NIM . Conversation []) =>

// listeners.forEach((listener) => listener.remove())



Note: This method is used for the first login of the user

try {
  const result = await NeteaseIm.login('account', 'token')
} catch (error) {
  console.log(error.code, error.message)



  1. Every time you start the App, you need to call this method for fast login, and fast login does not require a user name and token.
  2. This method has no return value and needs to monitor the connection status.
  3. When the user logs out, he must log in again and call this interface to log in successfully.
try {
  await NeteaseIm.autoLogin()
} catch (error) {


Check login status

const  logined  =  await  NeteaseIm . getLogined ( ) 
console . log ( 'Whether to log in:' ,  logined )


Note: This method has no return value



Send text message

try  { 
  const  result  =  await  NeteaseIm . sendMessage ( 
    'kangfenmao' , 
    'This is a text message' , 
    NimSessionTypeEnum . P2P , 
  console . log ( result ) 
}  catch  ( error )  { 
  console . log ( {  code : error . code ,  message : error . message  } ) 
  account: string,
  text: string,
  type: NimSessionTypeEnum,
  resend: boolean
): Promise<NIM.PromiseResult>


Get a message

getMessage(messageId: string, account: string, sessionType: SessionTypeEnum): Promise<NIM.Message>


Get historical news

  sessionId: string,
  sessionType: string,
  messageId: string,
  limit: number,
  asc: boolean
): Promise<NIM.Message[]>

Query the latest historical message when messageId is an empty string


Get a list of recent conversations

await NeteaseIm.getConversations()


Delete a single conversation

NeteaseIm.deleteConversation(sessionId, SessionType.P2P)


Reset session unread

NeteaseIm.resetConversationUnreadCount(sessionId, SessionTypeEnum.P2P)


Get total unread

await  NeteaseIm . getTotalUnreadCount ( )

SDK version


Push configuration

iOS push configuration

Modify index.jsthe Init method, and the second parameter passed Certificate Name:

NeteaseIm.init("appKey", "apnsCertname")

Android push configuration

In MainApplication.javaintroducing head

import com.netease.nimlib.sdk.mixpush.MixPushConfig;

Modify onCreateinitialization methods is added MixPushConfig:

NeteaseIm.init(this, "appKey", mixPushConfig);

mixPushConfig configuration

MixPushConfig mixPushConfig = new MixPushConfig();

// Mi push 
mixPushConfig . XmAppId =  " " ;
mixPushConfig.xmAppKey = "";
mixPushConfig.xmCertificateName = "";

// Huawei 
mixPushConfig . HwAppId =  " " ;
mixPushConfig.hwCertificateName = "";

// Meizu 
mixPushConfig . MzAppId =  " " ;
mixPushConfig.mzAppKey = "";
mixPushConfig.mzCertificateName = "";

mixPushConfig.oppoAppId = "";
mixPushConfig.oppoAppKey = "";
mixPushConfig.oppoAppSercet = "";
mixPushConfig.oppoCertificateName = "";

mixPushConfig.vivoCertificateName = "";


Clone the project to the local


yarn prepair

Modify example/env.json

yarn example ios


See the contributing guide to learn how to contribute to the repository and the development workflow.

Download Details:

Author: kangfenmao

Source Code:

react-native react mobile-apps

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How native is React Native? | React Native vs Native App Development

Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.

React Native Mobile App Development

Skenix is providing React Native Development Services with qualified React Native App Developers. Get the best React Native App Development Services.

How React Native Is Shaping Mobile App Development

Are you a mobile app developer looking for more efficient tools for your projects? Mobile app development is getting tougher and tougher as the market continues to grow. As a developer, you need to develop Apps which meet the demands of your users. To achieve this, adopt the right tools, like the React Native development framework.

Top React Native Mobile App Development Companies in USA

Looking for top React Native mobile app development company in USA for Startups & Enterprise? Find out the top list of React Native mobile app development company in USA.

Which is the best React Native app development company in New York?

Hire top react native app development company in New York to build and develop custom react native mobile apps for Android & iOS with the latest features.