cometchat-pro-tutorials / react-native-gifted-chat-app

Build React Native Gifted Chat App with CometChat React Native SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to Build a React Native Gifted Chat App [with CometChat SDK]

Read the full tutorial here: >> How to Build a React Native Gifted Chat App [with CometChat SDK]

Live Demo

This example shows How to Build a React Native Gifted Chat App [with CometChat SDK]:

Technology

This demo uses:

  • @cometchat-pro/react-native-calls
  • @cometchat-pro/react-native-chat
  • @react-native-async-storage/async-storage
  • @react-navigation/native
  • react-native-image-picker
  • react-native-get-random-values
  • react-native-gifted-chat
  • react-native-keep-awake
  • react-native-safe-area-context
  • react-native-screens
  • react-native-video
  • react-native-video-controls
  • Firebase
  • React
  • React Native
  • Uuid
  • Validator

Running the demo

To run the demo follow these steps:

  1. Head to CometChat Pro and create an account
  2. From the dashboard, add a new app called "react-native-gifted-chat-app"
  3. Select this newly added app from the list.
  4. From the Quick Start copy the APP_ID, APP_REGION and AUTH_KEY. These will be used later.
  5. Also copy the REST_API_KEY from the API & Auth Key tab.
  6. Navigate to the Users tab, and delete all the default users and groups leaving it clean (very important).
  7. Download the repository here or by running git clone https://github.com/hieptl/react-native-gifted-chat-app.git and open it in a code editor.
  8. Head to Firebase and create a new project
  9. Create a file called env.js in the root folder of your project.
  10. Import and inject your secret keys in the env.js file containing your CometChat and Firebase in this manner.
export const fbConfig = {
  apiKey: xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx,
  authDomain: xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx,
  projectId: xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx,
  storageBucket: xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx,
  messagingSenderId: xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx,
  appId: xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx
};

export const cometChatConfig = {
  cometChatAppId: xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx,
  cometChatRegion: xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx,
  cometChatAuthKey: xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx,
  cometChatRestApiKey: xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx
};
  1. cd to your root folder and hit npm i --force to install the packages.
  2. Run cd to the ios folder then run pod install to install the pods. Once pods are installed run cd .. to go back to the root folder.
  3. Run the app on iOS using npx react-native run-ios & on Android using npx react-native run-android
  4. Make sure to include env.js in your gitIgnore file from being exposed online.
  5. If you would like to test your application on IOS and you are using a Macbook - Apple Chip, you need to follow this link to configure your xcode and your ios project. CometChat - Set up for IOS
  6. If you would like to test your application on Android and you have to face with an issue related to ANDROIRD_ROOT_SDK. Please refer to this link to get the solution.

Questions about running the demo? Open an issue. We're here to help ✌️

Useful links

About

Build React Native Gifted Chat App with CometChat React Native SDK


Languages

Language:JavaScript 83.9%Language:Java 8.3%Language:Objective-C 5.9%Language:Ruby 1.1%Language:Starlark 0.8%