react-native-zendesk-ichat
v1.0.0
Published
Simple module that allows displaying Zopim Chat from Zendesk for React Native in the latest versions.
Downloads
12
Maintainers
Readme
react-native-zendesk-ichat
Getting started
Follow the instructions to install the SDK for iOS and Android.
$ npm install react-native-zendesk-ichat --save
or $ yarn add react-native-zendesk-ichat
Mostly automatic installation
$ react-native link react-native-zendesk-ichat
(Only versions less than 0.60)
Manual installation
iOS
Using CocoaPods (Best Approach)
- Go to
ios
➜pod install
. - Open up
ios/[...]/AppDelegate.m
- Add
#import <ZDCChat/ZDCChat.h>;
- Add
[ZDCChat initializeWithAccountKey:@"key"];
before thereturn YES;
in thedidFinishLaunchingWithOptions:(NSDictionary *)launchOptions
method;
Android
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.rnzendeskchat.RNZendeskChatPackage;
andcom.facebook.react.bridge.ReactApplicationContext;
to the imports at the top of the file - Add
static RNZendeskChatModule rnZendeskChatModule;
before theonCreate
method; - Add
ReactApplicationContext reactContext = new ReactApplicationContext(this);
rnZendeskChatModule = new RNZendeskChatModule(reactContext);
rnZendeskChatModule.init("key")
to theonCreate
method; - (Only versions less than 0.60) Add
new RNZendeskChatPackage()
to the list returned by thegetPackages()
method
- Insert the following lines inside the allprojects repositories block in
android/build.gradle
:maven { url 'https://zendesk.artifactoryonline.com/zendesk/repo' }
- (Only versions less than 0.60) Append the following lines to
android/settings.gradle
:include ':react-native-zendesk-ichat' project(':react-native-zendesk-ichat').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-zendesk-ichat/android')
- (Only versions less than 0.60) Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-zendesk-ichat')
Usage
import RNZendeskChat from 'react-native-zendesk-ichat';
ZendeskChat.startChat({
name: 'someName',
email: 'someEmail',
phone: 'somePhone',
tags: ['someTag1', 'someTag2'],
department: 'someDepartment'
})