From f644d7bf3ad7d37cc465a2d0b566b7a51043a0c6 Mon Sep 17 00:00:00 2001 From: nyatadecocoa Date: Fri, 16 Oct 2020 01:33:52 +0000 Subject: [PATCH 001/149] add react-native-elements and socket-io-client --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0839b72..8318c0e 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,8 @@ "@react-native-community/masked-view": "0.1.10", "@react-navigation/native": "^5.7.6", "@react-navigation/stack": "^5.9.3", + "@types/react-native-elements": "^0.18.0", + "@types/socket.io-client": "^1.4.34", "expo": "~39.0.2", "expo-status-bar": "~1.0.2", "react": "16.13.1", @@ -27,7 +29,7 @@ "devDependencies": { "@types/react": "~16.9.35", "@types/react-dom": "~16.9.8", - "@types/react-native": "~0.63.2", + "@types/react-native": "^0.63.25", "@typescript-eslint/eslint-plugin": "^4.3.0", "@typescript-eslint/parser": "^4.3.0", "eslint": "^7.10.0", From 029db4dc7ca1d03ed27190ef0107ab580d976e24 Mon Sep 17 00:00:00 2001 From: nyatadecocoa Date: Fri, 16 Oct 2020 01:34:29 +0000 Subject: [PATCH 002/149] add socket and modify room list --- App.tsx | 19 +++++-- src/screens/home/index.tsx | 7 ++- src/screens/room-list/index.tsx | 75 +++++++++++++++++--------- yarn.lock | 96 +++++++++++++++++++++++++++++++-- 4 files changed, 162 insertions(+), 35 deletions(-) diff --git a/App.tsx b/App.tsx index c6b8643..5ebb1a5 100644 --- a/App.tsx +++ b/App.tsx @@ -6,6 +6,9 @@ import RoomScreen from "./src/screens/room/index"; import RoomListScreen from "./src/screens/room-list/index"; import EditDeckScreen from "./src/screens/edit-deck/index"; import PreferencesScreen from "./src/screens/preferences/index"; +import io from "socket.io-client"; + +const socket = io("http://localhost:3000", { transports: ["websocket"] }); export default function App(): ReactElement { return ( @@ -17,8 +20,16 @@ export default function App(): ReactElement { headerTintColor: "white", }} > - - + + @@ -28,8 +39,8 @@ export default function App(): ReactElement { } export type RootStackParamList = { - Home: undefined; - Room: undefined; + Home: { socket: SocketIOClient.Socket }; + Room: { socket: SocketIOClient.Socket }; RoomList: undefined; EditDeck: undefined; Preferences: undefined; diff --git a/src/screens/home/index.tsx b/src/screens/home/index.tsx index b19bf7b..8153f86 100644 --- a/src/screens/home/index.tsx +++ b/src/screens/home/index.tsx @@ -1,13 +1,16 @@ import { StatusBar } from "expo-status-bar"; import React, { ReactElement } from "react"; -import { StyleSheet, View, Text, Button } from "react-native"; +import { StyleSheet, View, Text } from "react-native"; import { StackNavigationProp } from "@react-navigation/stack"; import { RootStackParamList } from "../../../App"; +import { Button } from "react-native-elements"; export default function HomeScreen({ navigation, + socket, }: { navigation: HomeScreenNavigationProp; + socket: SocketIOClient.Socket; }): ReactElement { return ( @@ -16,7 +19,7 @@ export default function HomeScreen({