react-native-zendesk-chat
Advanced tools
@@ -197,4 +197,12 @@ package com.taskrabbit.zendesk; | ||
| // Unfortunately, react-native: android doesn't support the following | ||
| // - Java's Method Overloading | ||
| // - automatically providing null to undefined parameters (like iOS) | ||
| // | ||
| // As a result, we need to guarantee this is always called with 2 parameters from JS | ||
| // | ||
| // This method has been renamed to make that clear, and index.js is adding the | ||
| // correct interface for init() at runtime | ||
| @ReactMethod | ||
| public void init(String key, String appId) { | ||
| public void _initWith2Args(String key, String appId) { | ||
| if (appId != null) { | ||
@@ -201,0 +209,0 @@ Chat.INSTANCE.init(mReactContext, key, appId); |
+16
-1
@@ -1,5 +0,20 @@ | ||
| import { NativeModules } from "react-native"; | ||
| import { NativeModules, Platform } from "react-native"; | ||
| const RNZendeskChatModule = NativeModules.RNZendeskChatModule; | ||
| Platform.select({ | ||
| default: () => { | ||
| return; | ||
| }, | ||
| android: () => { | ||
| // react-native android doesn't support Java method overloading | ||
| // So this code implements the init method but makes sure to call | ||
| // the right Java Code making sure there's a value for each parameter | ||
| // Reference: https://github.com/facebook/react-native/blob/07d090dbc6c46b8f3760dbd25dbe0540c18cb3f3/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaModuleWrapper.java#L85-L86 | ||
| RNZendeskChatModule.init = (key, appId) => { | ||
| return RNZendeskChatModule._initWith2Args(key, appId || null); | ||
| }; | ||
| }, | ||
| })(); | ||
| /** | ||
@@ -6,0 +21,0 @@ * TypeScript Documentation for this Module describes the available methods & parameters |
+1
-1
| { | ||
| "name": "react-native-zendesk-chat", | ||
| "version": "0.4.1-beta.1", | ||
| "version": "0.4.1-beta.2", | ||
| "description": "React Native Wrapper around Zopim Zendesk Chat", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
47191
2.22%460
5.02%