Expo Installation
This guide explains how to install the Kommunicate SDK for the Expo Bare Workflow.
Converting Managed Workflow to Bare Workflow
If your Expo app uses the Managed Workflow, you must convert it to the Bare Workflow to use the Kommunicate SDK.
Run the following command to add prebuilds (ios and android) to your project:
npx expo prebuild
This will generate the ios and android directories in your project, which are required to use the plugin.
Adding the Kommunicate Plugin
Install the Kommunicate module using npm:
npm install react-native-kommunicate-chat --save
iOS Configuration
Navigate to your iOS directory and open the
Podfile.properties.jsonfile.- Ensure the
newArchEnabledproperty is set to false.
- Ensure the
Open the
Podfileand ensure the following configurations:- Add
use_frameworks!to enable dynamic frameworks. - Ensure the minimum iOS platform version is set to 13 (if not already present).
Example:
platform :ios, '13.0' # Add only if not already present. use_frameworks!- Add
Android Configuration
Go to the
gradle.propertiesfile in your Android directory. Ensure the following properties are present and correctly set:android.enableJetifier=true android.jetifier.ignorelist=react-android,react-native newArchEnabled=falseOpen
android/build.gradleand add the Kommunicate repository underallprojects>repositories:maven { url 'https://kommunicate.jfrog.io/artifactory/kommunicate-android-sdk' }
Note: You can test the Kommunicate plugin using the sample Expo app. Check it out here: Expo-Kommunicate-Sample-App.
Import the module
You can use the module by importing it in your react native files as below:
import RNKommunicateChat from 'react-native-kommunicate-chat';
In the latest react native version above import statement might create a build issue. In that case, import the module using the following code:
var RNKommunicateChat = NativeModules.RNKommunicateChat;
Get your App Id
Sign up for Kommunicate to get your APP_ID. This APP_ID is used to create/launch conversations.
Launch chat
Kommunicate provides buildConversation function to create and launch chat directly saving you the extra steps of authentication, creation, initialization and launch. You can customize the process by building the conversationObject according to your requirements.
To launch the chat you need to create a conversation object. This object is passed to the buildConversation function and based on the parameters of the object the chat is created/launched.
Please look into [Conversation Section] (https://docs.kommunicate.io/docs/reactnative-conversation) for some sample flows.