我正在尝试将Freshchat与我的React-Native App集成

时间:2020-09-17 20:51:36

标签: react-native chat

我正在关注本文Freshchat React Native SDK Integration Steps,这是我的代码(Chat.js):

#导入新鲜聊天区

import { Freshchat, FreshchatConfig } from 'react-native-freshchat-sdk';
import { FreshchatUser } from 'react-native-freshchat-sdk';

#SDK的初始化

var freshchatConfig = new FreshchatConfig('MY_APP_ID', 'MY_APP_KEY');
freshchatConfig.domain = "MY-DOMAIN";
Freshchat.init(freshchatConfig);

#用户信息

var freshchatUser = new FreshchatUser();
Freshchat.setUser(freshchatUser, (error) => {
  console.log(error);
});

#尝试发起对话

        <View>
        <Button
        title="start chat"
        onPress={() => Freshchat.showConversations()}
      />

        </View>

这时我的应用程序意外关闭。我需要重新打开它,但是看不到任何对话或Freshchat屏幕。您能帮我解决这个问题或任何参考或建议吗?

谢谢。

快乐编码:)

更新:Android和iOS均使用上述代码。

0 个答案:

没有答案
相关问题