Closed EsioFreitas closed 1 year ago
Hello. I put the server example in the code and it is giving an error. Could you please help me?
import React, { useEffect, useRef } from "react"; import { View, Text, ImageBackground } from "react-native"; import Button from "../../components/button"; import splashImg from "../../assets/splash.png"; import { useDispatch, useSelector } from "react-redux"; import { getUserInfo } from "../../store/Identity/Authenticate/selectors"; import { fetchUser } from "../../store/Identity/Authenticate/thunks"; import { AppRoutes } from "../../navigation/routes"; import TcpSocket from "react-native-tcp-socket"; const LoginPage = ({ navigation }) => { const server = TcpSocket.createServer(function (socket) { socket.on("data", (data) => { socket.write("Echo server " + data); }); socket.on("error", (error) => { console.log("An error ocurred with client socket ", error); }); socket.on("close", (error) => { console.log("Closed connection with ", socket.address()); }); }).listen({ port: 12345, host: "0.0.0.0" }); server.on("error", (error) => { console.log("An error ocurred with the server", error); }); server.on("close", () => { console.log("Server closed connection"); }); return ( <View style={{ flex: 1 }}> <ImageBackground style={{ flex: 1, justifyContent: "flex-end", alignItems: "center", }} source={splashImg} resizeMode="cover" > <View style={{ width: "50%", marginBottom: 100 }}> <Button title="Entrar" onPress={() => navigation.navigate(AppRoutes.filterPage)} type="secondary" /> </View> </ImageBackground> </View> ); }; export default LoginPage;
@EsioFreitas, I believe your issue is related to #122, #103 and #27. Please, take a look at #103 for a list of possible fixes.
Message
Hello. I put the server example in the code and it is giving an error. Could you please help me?
Code:
Error