Closed arcln closed 3 months ago
I totally agree it should not call show on mount. This force us to make workarounds and make the .show function useless in the current situation. A manual call of .show() would make much more sense.
I use a patch-package file like this meanwhile :
diff --git a/node_modules/react-native-crisp-chat-sdk/src/index.tsx b/node_modules/react-native-crisp-chat-sdk/src/index.tsx
index bc14a66..46785e0 100644
--- a/node_modules/react-native-crisp-chat-sdk/src/index.tsx
+++ b/node_modules/react-native-crisp-chat-sdk/src/index.tsx
@@ -33,7 +33,7 @@ const CrispChatSdk = NativeModules.CrispChatSdk as CrispChatSdkType;
const CrispChat: React.FC = () => {
React.useEffect(() => {
- CrispChatSdk.show();
+ // CrispChatSdk.show();
}, []);
return <View />;
It should be solved with latest version :)
Hello,
This library does not play well with latest RN navigation. The chat opens in its own view regardless of where you placed the
<CrispChat />
component.That's because the Crisp SDKs are not react-friendly but were wrapped to make us believe so :
The
<CrispChat />
component is in fact an empty view that calls.show()
.https://github.com/walterholohan/react-native-crisp-chat-sdk/blob/5c982996ef76e8265446185fd666bfdaa02cca84/src/index.tsx#L39
I think this should be stated in the readme. The correct way to use the library with RN navigation is to not use the component and directly call
.show()
yourself.Just posting this so it maybe help others.