You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+53-9Lines changed: 53 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,19 @@
1
1
# react-native-zendesk-chat
2
2
3
-
Simple module that allows displaying Zopim Chat from Zendesk for React Native.
3
+
Simple module that supports displaying Zendesk Chat within a React Native Application.
4
+
5
+
This library assumes you're familiar with Zendesk's Official Documentation: [iOS](https://developer.zendesk.com/embeddables/docs/chat-sdk-v-2-for-ios/introduction) and [Android](https://developer.zendesk.com/embeddables/docs/chat-sdk-v-2-for-android/introductionn).
4
6
5
7
## VERSIONS
6
8
7
-
- For RN version higher than 0.59 use version >= 0.3.0 (Zendesk Chat v1)
8
-
- For RN version lower than 0.59 use version <= 0.2.2 (Zendesk Chat v1)
9
+
- For **Zendesk Chat v2** use version >= 0.4.0 (this requires RN 0.59 or later!)
10
+
- For RN version >= 0.59 use version >= 0.3.0 (Zendesk Chat v1)
11
+
- For RN version < 0.59 use version <= 0.2.2 (Zendesk Chat v1)
9
12
10
13
## Known Issues
11
14
12
15
## Getting Started
13
16
14
-
Follow the instructions to install the SDK for [iOS](https://developer.zendesk.com/embeddables/docs/ios-chat-sdk/introduction) and [Android](https://developer.zendesk.com/embeddables/docs/android-chat-sdk/introduction).
15
-
16
17
With npm:
17
18
18
19
`npm install react-native-zendesk-chat --save`
@@ -33,7 +34,7 @@ $ (cd ios; pod install) # and see if there are any errors
33
34
34
35
If you're on older react-native versions, please see the [Advanced Setup](#advanced-setup) section below
35
36
36
-
**Android** If you're on react-native >= 0.60, Android should autodetect this dependency. You may need to call `react-native link`
37
+
**Android** If you're on react-native >= 0.60, Android should autodetect this dependency. If you're on 0.59, you may need to call `react-native link`
37
38
38
39
2. Call the JS Initializer:
39
40
@@ -54,9 +55,40 @@ ZendeskChat.startChat({
54
55
phone:user.mobile_phone,
55
56
tags: ["tag1", "tag2"],
56
57
department:"Your department",
58
+
// The behaviorFlags are optional, and each default to 'true' if omitted
59
+
behaviorFlags: {
60
+
showAgentAvailability:true,
61
+
showChatTranscriptPrompt:true,
62
+
showPreChatForm:true,
63
+
showOfflineForm:true,
64
+
},
65
+
// The preChatFormOptions are optional & each defaults to "optional" if omitted
66
+
preChatFormOptions: {
67
+
name:!user.full_name?"required":"optional",
68
+
email:"optional",
69
+
phone:"optional",
70
+
department:"required",
71
+
},
72
+
localizedDismissButtonTitle:"Dismiss",
57
73
});
58
74
```
59
75
76
+
### Styling
77
+
78
+
Changing the UI Styling is mostly achieved through native techniques.
79
+
80
+
On Android, this is the [official documentation](https://developer.zendesk.com/embeddables/docs/android-unified-sdk/customize_the_look#how-theming-works) -- and an example might be adding these [3 lines to your app theme](https://github.com/zendesk/sdk_demo_app_android/blob/ae4c551f78911e983b0aac06967628f46be15e54/app/src/main/res/values/styles.xml#L5-L7)
81
+
82
+
While on iOS, the options are more minimal -- check the [official doc page](https://developer.zendesk.com/embeddables/docs/chat-sdk-v-2-for-ios/customize_the_look#styling-the-chat-screen)
83
+
84
+
### Migrating
85
+
86
+
_From react-native-zendesk-chat <= 0.3.0_
87
+
88
+
To migrate from previous versions of the library, you should probably remove all integration steps you applied, and start over from the [Quick Start](#quickstart--usage).
89
+
90
+
The JS API calls are very similar, with mostly additive changes.
91
+
60
92
### Advanced Setup
61
93
62
94
Advanced users, or users running on older versions of react-native may want to initialize things in native.
@@ -110,16 +142,28 @@ project(':react-native-zendesk-chat').projectDir = new File(rootProject.projectD
110
142
111
143
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
112
144
145
+
For RN >= 0.60:
146
+
147
+
```gradle
148
+
dependencies {
149
+
//
150
+
api group: 'com.zendesk', name: 'chat', version: '2.2.0'
151
+
api group: 'com.zendesk', name: 'messaging', version: '4.3.1'
152
+
```
153
+
154
+
For RN < 0.60:
155
+
113
156
```gradle
114
157
compile project(':react-native-zendesk-chat')
115
158
```
116
159
117
-
4. Configure `ZopimChat` in `android/app/main/java/[...]/MainActivity.java`
160
+
4. Configure `Chat` in `android/app/main/java/[...]/MainActivity.java`
118
161
119
162
```java
120
-
// Note: there is a JS method to do this!
163
+
// Note: there is a JS method to do this -- prefer doing that! -- This is for advanced users only.
164
+
121
165
// Call this once in your Activity's bootup lifecycle
0 commit comments