ConnectyCube expo对RNChat的原生支持做出React

ncgqoxb0  于 2023-01-14  发布在  React
关注(0)|答案(1)|浏览(104)

有没有机会得到一个RNChat的例子,它运行在最新的世博会React本地支持像世博会AV播放器或世博会触觉伟大的世博会插件?
编辑:构建失败
===构建项目Pod的目标React代码,并进行配置调试===
检查依赖项

构建失败

以下生成命令失败:编译SwiftSources正常x86_64 com.apple.xcode.tools.swift.编译器编译Swiftsources正常x86_64(2次失败)
我得到吨的错误使用expo和expo模块核心像:
expo-模块-核心/类组件工厂swift:71:52:错误:未知属性“_implicitSelfCapture”

expo-模块-核心/ios/Swift/动态类型/动态枚举类型。swift:7:22:错误:应为声明字母innerType:任意可枚举类型

x8diyxa7

x8diyxa71#

很遗憾,我们没有Expo的聊天应用示例。你提供的错误与ConnectyCube的服务无关。
您可以使用我们的ConnectyCube SDK制作聊天应用程序,该SDK支持Expo,但不支持WebRTC(视频/音频通话)。
查看文档如何使用ConnectyCube的API和React Native here聊天
尝试简单的代码如何使用ConnectyCube SDK与博览会:

  1. npx创建博览会应用程序博览会连接立方体
  2. CD曝光连接立方体
    1.Yarn添加React-天然连接立方体
    1.Yarn输入输出
import { StatusBar } from "expo-status-bar";
    import { useEffect, useState } from "react";
    import { StyleSheet, Text, View } from "react-native";
    import ConnectyCube from "react-native-connectycube";
const creds = {
      appId: 385,
      authKey: "DFBMs5-dKBBCXcd",
      authSecret: "SkCW-ThdnmRg9Za",
    };
    
    const conf = {
      debug: { mode: 1 },
    };
    
    const user = {
      id: 72780,
      login: "videouser1",
      password: "videouser1",
    };
export default function App() {
      const [session, setSession] = useState("empty");
      const [chat, setChat] = useState(false);
      const [message, setMessage] = useState("");
    
      const initConnectyCube = () => {
        ConnectyCube.init(creds, conf);
      };
    
      const createAuthSession = () => {
        ConnectyCube.createSession({ login: user.login, password: user.password })
          .then((result) => {
            setSession(result);
          })
          .catch((sessionError) => setChat(sessionError));
      };
    
      const chatConnect = () => {
        ConnectyCube.chat.onMessageListener = (user, message) => {
          setMessage({ user, message });
        };
    
        ConnectyCube.chat
          .connect({ userId: user.id, password: user.password })
          .then(() => {
            setChat(true);
            ConnectyCube.chat.send(user.id, { body: "Hello", type: "chat" });
          })
          .catch((chatError) => setChat(chatError));
      };
    
      useEffect(() => {
        initConnectyCube();
        createAuthSession();
        chatConnect();
      }, []);
    
      return (
        <View style={styles.container}>
          <Text>{`Session: ${JSON.stringify(session)} \n`}</Text>
          <Text>{`Chat connected: ${chat} \n`}</Text>
          <Text>{`onMessage: ${JSON.stringify(message)} \n`}</Text>
          <StatusBar style="auto" />
        </View>
      );
    }
    
    const styles = StyleSheet.create({
      container: {
        flex: 1,
        backgroundColor: "#fff",
        justifyContent: "center",
      },
    });

相关问题