尝试使用react-native-sdk将verloop与react-native集成。调用函数VerloopSdk.showChat()时变得未定义
从'react'导入React,{Component}; 从'react-native-verloop-sdk'导入VerloopSdk;
导出默认类VerloopLiveChat扩展了组件{
async componentDidMount() {
const clientId = "<YOUR COMPANY ID>"; // it is same as https://<YOUR COMPANY ID>.verloop.io
await VerloopSdk.createAnonymousUserConfig(clientId);
//or
await VerloopSdk.createUserConfig(clientId, userId);
//optional
VerloopSdk.putCustomField(key, value);
//optional
VerloopSdk.setRecipeId(recipeId);
//optional
VerloopSdk.setUserEmail(email);
//optional
VerloopSdk.setUserPhone(phoneNumber);
//optional
VerloopSdk.setUserName(name);
VerloopSdk.showChat();
}
render() {
return null;
}
}