如何解决有没有更好的方法将LandbotChatBot集成到React Native App中?
当前,我已将此chatbot嵌入到WebView
这样的东西中。
import React,{ useRef } from 'react';
import { StyleSheet,View,SafeAreaView } from 'react-native';
import HeaderV2 from '../../components/HeaderV2';
import { WebView,WebViewNavigation } from 'react-native-webview';
export default function LandBotPage() {
const botUrl = 'BOT_URL_HERE';
const webViewRef = useRef<WebView>();
return (
<SafeAreaView style={styles.container}>
<HeaderV2 />
<View style={styles.container}>
<WebView
ref={webViewRef}
originWhitelist={['*']}
startInLoadingState={false}
cacheEnabled={false}
pullToRefreshEnabled={true}
style={styles.webView}
source={{ uri: botUrl }}
onNavigationStateChange={(navstate: WebViewNavigation) => {
console.log(navstate.url);
}}
/>
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {flex: 1 },webView: {flex: 1 },});
解决方法
我不确定您可以通过什么方式实现此特定的聊天机器人,我查看了Landbot网站,但找不到开发人员文档。
我能给您的一个普遍答案是,您可以使用increase()
和<View>
实现所需的外观,然后通过<Text>
调用来调用Chatbot API端点。您可以在官方文档here中阅读有关在React Native应用程序中获取数据的更多信息。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。