3.0.13 • Published 9 months ago

@cometchat-pro/react-native-chat v3.0.13

Weekly downloads
182
License
SEE LICENSE IN LI...
Repository
github
Last release
9 months ago

CometChat React Native SDK

CometChat Pro enables you to add voice, video & text chat for your website & app. This guide demonstrates how to add chat to a React Native App using CometChat Pro.

Features

Extensions

Push Notification | Email Notification | SMS Notification | Thumbnail Generation | Link Preview | Rich Media Preview | Voice Transcription | Smart Reply | Message Translation | Emojis | Polls | Reactions | Stickers | Video Broadcasting | Collaborative Documents | Collaborative Whiteboards | Data Masking Filter | Profanity Filter | Image Moderation| Sentiment Analysis | In-flight Message Moderation | Virus & Malware Scanner | XSS Filter

Platform GitHub repo size GitHub contributors GitHub stars Twitter Follow

Prerequisites :star:

Before you begin, ensure you have met the following requirements:  You have Visual Studio Code or any other code editor installed in your machine.  To run native projects you will need to have Android Studio & Xcode installed in your machine.  You have npm installed in your machine.  You have read CometChat Key Concepts.

Installing CometChat React Native SDK

Setup :wrench:

To setup React Native SDK, you need to first register on CometChat Dashboard. Click here to sign up.

i. Get your Application Keys :key:

Signup for CometChat and then:

  1. Create a new app: Click Add App option available → Enter App Name & other information → Create App
  2. At the Top in QuickStart section you will find Auth Key & App ID or else you can head over to the API & Auth Keys section and note the Auth Key and App ID

ii. Add the CometChat Dependency

	npm install @cometchat-pro/react-native-chat@3.0.11 --save

You can refer to the below link for instructions on how to do so: 📝 Add CometChat Dependency

Configure CometChat React Native SDK

i. Initialize CometChat 🌟

We suggest you call the init() method on app startup, preferably in the index.js file.

var appID = "APP_ID";
var region = "REGION";
var appSetting = new CometChat.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build();
CometChat.init(appID, appSetting).then(
  () => {
    console.log("Initialization completed successfully");
  },
  error => {
    console.log("Initialization failed with error:", error);
  }
);
:information_source:   Note: Make sure to replace region and appID with your credentials.

ii. Create User 👤

Once initialisation is successful, you will need to create a user. You need to use createUser() method to create user on the fly.

let authKey = "AUTH_KEY";
var uid = "user1";
var name = "Kevin";

var user = new CometChat.User(uid);

user.setName(name);

CometChat.createUser(user, authKey).then(
  user => {
    console.log("user created", user);
  },error => {
    console.log("error", error);
  }
);

:information_source: Note: Make sure that UID and name are specified as these are mandatory fields to create a user.

iii. Login User 👤

Once you have created the user successfully, you will need to log the user into CometChat using the login() method.

var UID = "SUPERHERO1";
var authKey = "AUTH_KEY";

CometChat.getLoggedinUser().then(
  user => {
    if(!user){
      CometChat.login(UID, authKey).then(
        user => {
          console.log("Login Successful:", { user });    
        },
        error => {
          console.log("Login failed with exception:", { error });    
        }
      );
    }else{
      // User already logged in
    }
  }, error => {
    console.log("getLoggedinUser failed with exception:", { error });
  }
);
:information_source:   Note - The login() method needs to be called only once. Also replace AUTH_KEY with your App Auth Key.

📝 Please refer to our Developer Documentation for more information on how to configure the CometChat Pro SDK and implement various features using the same.

Learn more about UI-Kit

React Native UI Kit

Contributors :clap:

Thanks to the following people who have contributed to this project: 👨‍💻 @mayur-bhandari 👨‍💻 @jitvarpatil

Contact :mailbox:

Contact us via real time support present in CometChat Dashboard.

3.0.13

9 months ago

3.0.13-beta1

9 months ago

3.0.12

12 months ago

3.0.11

1 year ago

3.0.10

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.9

2 years ago

2.4.1

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.4.0

3 years ago

3.0.0-beta5

3 years ago

3.0.0-beta4

3 years ago

2.3.4

3 years ago

2.3.3

3 years ago

2.3.1-beta1

3 years ago

3.0.0-beta3

3 years ago

3.0.0-beta2

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

3.0.0-beta1

3 years ago

2.3.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.8-beta1

3 years ago

2.1.7

3 years ago

2.1.6

3 years ago

2.1.5

3 years ago

2.1.4

3 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.1-beta1

4 years ago

2.1.0

4 years ago

2.1.0-beta5

4 years ago

2.1.0-beta6

4 years ago

2.1.0-beta4

4 years ago

2.1.0-beta3

4 years ago

2.0.13-beta1

4 years ago

2.1.0-beta2

4 years ago

0.0.1-beta9

4 years ago

2.0.12

4 years ago

2.0.11

4 years ago

2.0.10

4 years ago

2.0.9

4 years ago

2.0.9-beta2

4 years ago

0.0.1-beta8

4 years ago

2.0.9-beta1

4 years ago

2.0.8

4 years ago

2.0.8-beta3

4 years ago

2.1.0-beta1

4 years ago

0.0.1-beta7

4 years ago

0.0.1-beta6

4 years ago

2.0.8-beta2

4 years ago

0.0.1-beta5

4 years ago

0.0.1-beta4

4 years ago

0.0.1-beta3

4 years ago

0.0.1-beta2

4 years ago

0.0.1-beta1

4 years ago

2.0.8-beta1

4 years ago

2.0.7

4 years ago

2.0.7-beta1

4 years ago

2.0.6

4 years ago

2.0.5-beta1

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

1.8.5

5 years ago

1.8.4

5 years ago

1.8.3

5 years ago

1.8.2

5 years ago

1.8.1

5 years ago

1.7.1

5 years ago

1.8.0

5 years ago