Skip to content

Instantly share code, notes, and snippets.

@hieptl
Created December 7, 2021 07:53
Show Gist options
  • Select an option

  • Save hieptl/6bd55af3c2725400637b19fdde644ade to your computer and use it in GitHub Desktop.

Select an option

Save hieptl/6bd55af3c2725400637b19fdde644ade to your computer and use it in GitHub Desktop.
App.js - init CometChat - Zocdoc Clone
useEffect(() => {
initCometChat();
}, []);
const initCometChat = async () => {
const { CometChat } = await import('@cometchat-pro/react-native-chat');
const appID = `${cometChatConfig.cometChatAppId}`;
const region = `${cometChatConfig.cometChatRegion}`;
const appSetting = new CometChat.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build();
CometChat.init(appID, appSetting).then(
() => {
console.log('CometChat was initialized successfully');
setCometChat(() => CometChat);
},
error => {
}
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment