File tree Expand file tree Collapse file tree 2 files changed +10
-16
lines changed Expand file tree Collapse file tree 2 files changed +10
-16
lines changed Original file line number Diff line number Diff line change 1
- import { NativeModules , Platform } from "react-native" ;
1
+ import { NativeModules } from "react-native" ;
2
2
3
3
const RNZendeskChatModule = NativeModules . RNZendeskChatModule ;
4
4
5
- Platform . select ( {
6
- default : ( ) => {
7
- return ;
8
- } ,
9
- android : ( ) => {
10
- // react-native android doesn't support Java method overloading
11
- // So this code implements the init method but makes sure to call
12
- // the right Java Code making sure there's a value for each parameter
13
- // Reference: https://github.com/facebook/react-native/blob/07d090dbc6c46b8f3760dbd25dbe0540c18cb3f3/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaModuleWrapper.java#L85-L86
14
- RNZendeskChatModule . init = ( key , appId ) => {
15
- return RNZendeskChatModule . _initWith2Args ( key , appId || null ) ;
16
- } ;
17
- } ,
18
- } ) ( ) ;
5
+ // react-native doesn't support method overloading for Java or Objective-C
6
+ // So this code implements the init method but makes sure to
7
+ // always call it with two defined parameters, passing null for the second as needed
8
+ // Reference: https://github.com/facebook/react-native/blob/07d090dbc6c46b8f3760dbd25dbe0540c18cb3f3/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaModuleWrapper.java#L85-L86
9
+
10
+ RNZendeskChatModule . init = ( key , appId ) => {
11
+ return RNZendeskChatModule . _initWith2Args ( key , appId || null ) ;
12
+ } ;
19
13
20
14
/**
21
15
* TypeScript Documentation for this Module describes the available methods & parameters
Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ - (void) dismissChatUI {
187
187
[RCTPresentedViewController () dismissViewControllerAnimated: YES completion: nil ];
188
188
}
189
189
190
- RCT_EXPORT_METHOD (init :(NSString *)zenDeskKey appId:(NSString *)appId) {
190
+ RCT_EXPORT_METHOD (_initWith2Args :(NSString *)zenDeskKey appId:(NSString *)appId) {
191
191
if (appId) {
192
192
[ZDKChat initializeWithAccountKey: zenDeskKey appId: appId queue: dispatch_get_main_queue ()];
193
193
} else {
You can’t perform that action at this time.
0 commit comments