diff --git a/client/App.tsx b/client/App.tsx index cd2a5f69d..e0222d60d 100644 --- a/client/App.tsx +++ b/client/App.tsx @@ -1,14 +1,44 @@ import React from "react"; import { StyleSheet, View, Text } from "react-native"; +import { AuthStore } from "./src/services/store"; +import { NavigationContainer } from "@react-navigation/native"; +import { createStackNavigator } from "@react-navigation/stack"; +import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; +import WelcomeScreen from "./src/components/Home/WelcomeScreen"; +import SignUpScreen from "./src/components/Auth/SignUpScreen"; +import LoginScreen from "./src/components/Auth/LoginScreen"; +import ChatScreen from "./src/components/Chat/ChatScreen"; +import SettingsScreen from "./src/components/Settings/SettingsScreen"; + +const Stack = createStackNavigator(); +const Tab = createBottomTabNavigator(); + +const App = () => { + const { initialized, isLoggedin } = AuthStore.useState(); + + if (!initialized) return Loading...; -export default function App() { return ( - - This Componenet is DEPRECATED. - DO NOT TOUCH. THE NEW ENTRY POINT IS AT 'app/index.tsx' - + + {isLoggedin ? ( + + + + + ) : ( + + + + + + )} + ); -} +}; const styles = StyleSheet.create({ container: { @@ -18,3 +48,5 @@ const styles = StyleSheet.create({ justifyContent: "center", }, }); + +export default App; diff --git a/client/package-lock.json b/client/package-lock.json index eb11d1b71..a1a0f0199 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -12,6 +12,9 @@ "@react-native-async-storage/async-storage": "1.18.2", "@react-native-firebase/app": "^18.7.3", "@react-native-firebase/auth": "^18.7.3", + "@react-navigation/bottom-tabs": "^6.5.20", + "@react-navigation/native": "^6.1.17", + "@react-navigation/stack": "^6.3.29", "expo": "~49.0.12", "expo-cli": "^6.3.10", "expo-constants": "~14.4.2", @@ -6736,11 +6739,11 @@ } }, "node_modules/@react-navigation/bottom-tabs": { - "version": "6.5.11", - "resolved": "https://registry.npmjs.org/@react-navigation/bottom-tabs/-/bottom-tabs-6.5.11.tgz", - "integrity": "sha512-CBN/NOdxnMvmjw+AJQI1kltOYaClTZmGec5pQ3ZNTPX86ytbIOylDIITKMfTgHZcIEFQDymx1SHeS++PIL3Szw==", + "version": "6.5.20", + "resolved": "https://registry.npmjs.org/@react-navigation/bottom-tabs/-/bottom-tabs-6.5.20.tgz", + "integrity": "sha512-ow6Z06iS4VqBO8d7FP+HsGjJLWt2xTWIvuWjpoCvsM/uQXzCRDIjBv9HaKcXbF0yTW7IMir0oDAbU5PFzEDdgA==", "dependencies": { - "@react-navigation/elements": "^1.3.21", + "@react-navigation/elements": "^1.3.30", "color": "^4.2.3", "warn-once": "^0.1.0" }, @@ -6753,16 +6756,16 @@ } }, "node_modules/@react-navigation/core": { - "version": "6.4.10", - "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-6.4.10.tgz", - "integrity": "sha512-oYhqxETRHNHKsipm/BtGL0LI43Hs2VSFoWMbBdHK9OqgQPjTVUitslgLcPpo4zApCcmBWoOLX2qPxhsBda644A==", + "version": "6.4.16", + "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-6.4.16.tgz", + "integrity": "sha512-UDTJBsHxnzgFETR3ZxhctP+RWr4SkyeZpbhpkQoIGOuwSCkt1SE0qjU48/u6r6w6XlX8OqVudn1Ab0QFXTHxuQ==", "dependencies": { "@react-navigation/routers": "^6.1.9", "escape-string-regexp": "^4.0.0", "nanoid": "^3.1.23", "query-string": "^7.1.3", "react-is": "^16.13.0", - "use-latest-callback": "^0.1.7" + "use-latest-callback": "^0.1.9" }, "peerDependencies": { "react": "*" @@ -6780,9 +6783,9 @@ } }, "node_modules/@react-navigation/elements": { - "version": "1.3.21", - "resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-1.3.21.tgz", - "integrity": "sha512-eyS2C6McNR8ihUoYfc166O1D8VYVh9KIl0UQPI8/ZJVsStlfSTgeEEh+WXge6+7SFPnZ4ewzEJdSAHH+jzcEfg==", + "version": "1.3.30", + "resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-1.3.30.tgz", + "integrity": "sha512-plhc8UvCZs0UkV+sI+3bisIyn78wz9O/BiWZXpounu72k/R/Sj5PuZYFJ1fi6psvriUveMCGh4LeZckAZu2qiQ==", "peerDependencies": { "@react-navigation/native": "^6.0.0", "react": "*", @@ -6791,11 +6794,11 @@ } }, "node_modules/@react-navigation/native": { - "version": "6.1.9", - "resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-6.1.9.tgz", - "integrity": "sha512-AMuJDpwXE7UlfyhIXaUCCynXmv69Kb8NzKgKJO7v0k0L+u6xUTbt6xvshmJ79vsvaFyaEH9Jg5FMzek5/S5qNw==", + "version": "6.1.17", + "resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-6.1.17.tgz", + "integrity": "sha512-mer3OvfwWOHoUSMJyLa4vnBH3zpFmCwuzrBPlw7feXklurr/ZDiLjLxUScOot6jLRMz/67GyilEYMmP99LL0RQ==", "dependencies": { - "@react-navigation/core": "^6.4.10", + "@react-navigation/core": "^6.4.16", "escape-string-regexp": "^4.0.0", "fast-deep-equal": "^3.1.3", "nanoid": "^3.1.23" @@ -6806,11 +6809,11 @@ } }, "node_modules/@react-navigation/native-stack": { - "version": "6.9.17", - "resolved": "https://registry.npmjs.org/@react-navigation/native-stack/-/native-stack-6.9.17.tgz", - "integrity": "sha512-X8p8aS7JptQq7uZZNFEvfEcPf6tlK4PyVwYDdryRbG98B4bh2wFQYMThxvqa+FGEN7USEuHdv2mF0GhFKfX0ew==", + "version": "6.9.26", + "resolved": "https://registry.npmjs.org/@react-navigation/native-stack/-/native-stack-6.9.26.tgz", + "integrity": "sha512-++dueQ+FDj2XkZ902DVrK79ub1vp19nSdAZWxKRgd6+Bc0Niiesua6rMCqymYOVaYh+dagwkA9r00bpt/U5WLw==", "dependencies": { - "@react-navigation/elements": "^1.3.21", + "@react-navigation/elements": "^1.3.30", "warn-once": "^0.1.0" }, "peerDependencies": { @@ -6840,6 +6843,24 @@ "nanoid": "^3.1.23" } }, + "node_modules/@react-navigation/stack": { + "version": "6.3.29", + "resolved": "https://registry.npmjs.org/@react-navigation/stack/-/stack-6.3.29.tgz", + "integrity": "sha512-tzlGkoRgB6P7vgw7rHuWo3TL7Gzu6xh5LMf+zSdCuEiKp/qASzxYfnTEr9tOLbVs/gf+qeukEDheCSAJKVpBXw==", + "dependencies": { + "@react-navigation/elements": "^1.3.30", + "color": "^4.2.3", + "warn-once": "^0.1.0" + }, + "peerDependencies": { + "@react-navigation/native": "^6.0.0", + "react": "*", + "react-native": "*", + "react-native-gesture-handler": ">= 1.0.0", + "react-native-safe-area-context": ">= 3.0.0", + "react-native-screens": ">= 3.0.0" + } + }, "node_modules/@segment/loosely-validate-event": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-2.0.0.tgz", @@ -8408,13 +8429,18 @@ } }, "node_modules/call-bind": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", - "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.1", - "set-function-length": "^1.1.1" + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -9567,16 +9593,19 @@ } }, "node_modules/define-data-property": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", - "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", "dependencies": { - "get-intrinsic": "^1.2.1", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/define-lazy-prop": { @@ -9966,6 +9995,25 @@ "node": ">= 0.8" } }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-module-lexer": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.4.1.tgz", @@ -11247,9 +11295,9 @@ } }, "node_modules/expo-router": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/expo-router/-/expo-router-2.0.14.tgz", - "integrity": "sha512-F5dP4WMe+zQLzlGSbC+NT9/67FGgwmUCJuPGD4BkK0eRt0uga+y53vQ59m5MCOebqE0N9Ukr/Jz8Num16iGqZA==", + "version": "2.0.15", + "resolved": "https://registry.npmjs.org/expo-router/-/expo-router-2.0.15.tgz", + "integrity": "sha512-6TZKWG6nVne5kGjTPOInAEsSmWy2K4DxXp96OoNUXKoRbJYIZyB++0VQRhXcUCGQSXZRfUa0z2ud8CusF+axNA==", "dependencies": { "@bacons/react-views": "^1.1.3", "@expo/metro-runtime": "2.2.16", @@ -11267,10 +11315,6 @@ "peerDependencies": { "@react-navigation/drawer": "^6.5.8", "expo": "^49.0.0", - "expo-constants": "*", - "expo-linking": "*", - "expo-status-bar": "*", - "metro": "~0.76.7", "react-native-gesture-handler": "*", "react-native-reanimated": "*", "react-native-safe-area-context": "*", @@ -12015,15 +12059,19 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", - "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "dependencies": { + "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -12207,20 +12255,20 @@ } }, "node_modules/has-property-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", - "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", "dependencies": { - "get-intrinsic": "^1.2.2" + "es-define-property": "^1.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", "engines": { "node": ">= 0.4" }, @@ -17639,9 +17687,9 @@ } }, "node_modules/react-native-gesture-handler": { - "version": "2.14.1", - "resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-2.14.1.tgz", - "integrity": "sha512-YiM1BApV4aKeuwsM6O4C2ufwewYEKk6VMXOt0YqEZFMwABBFWhXLySFZYjBSNRU2USGppJbfHP1q1DfFQpKhdA==", + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-2.16.0.tgz", + "integrity": "sha512-1hFkx7RIfeJSyTQQ0Nkv4icFVZ5+XjQkd47OgZMBFzoB7ecL+nFSz8KLi3OCWOhq+nbHpSPlSG5VF3CQNCJpWA==", "peer": true, "dependencies": { "@egjs/hammerjs": "^2.0.17", @@ -18420,15 +18468,16 @@ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" }, "node_modules/set-function-length": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", - "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", "dependencies": { - "define-data-property": "^1.1.1", + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.2", + "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.1" + "has-property-descriptors": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -18488,13 +18537,17 @@ } }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -19920,11 +19973,11 @@ "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==" }, "node_modules/url/node_modules/qs": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", - "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.0.tgz", + "integrity": "sha512-trVZiI6RMOkO476zLGaBIzszOdFPnCCXHPG9kn0yuS1uz6xdVxPfZdB3vUig9pxPFDM9BRAgz/YUIVQ1/vuiUg==", "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" diff --git a/client/package.json b/client/package.json index 995d4e31d..a41d23021 100644 --- a/client/package.json +++ b/client/package.json @@ -1,7 +1,7 @@ { "name": "osc-proximity-chat-app", "version": "1.0.0", - "main": "expo-router/entry", + "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", @@ -13,6 +13,9 @@ "@react-native-async-storage/async-storage": "1.18.2", "@react-native-firebase/app": "^18.7.3", "@react-native-firebase/auth": "^18.7.3", + "@react-navigation/bottom-tabs": "^6.5.20", + "@react-navigation/native": "^6.1.17", + "@react-navigation/stack": "^6.3.29", "expo": "~49.0.12", "expo-cli": "^6.3.10", "expo-constants": "~14.4.2", @@ -35,10 +38,10 @@ "react-native-fs": "^2.20.0", "react-native-safe-area-context": "4.6.3", "react-native-screens": "~3.22.0", + "react-native-svg": "13.9.0", "react-native-uuid": "^2.0.1", "react-native-web": "~0.19.6", - "socket.io-client": "^4.7.4", - "react-native-svg": "13.9.0" + "socket.io-client": "^4.7.4" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/client/src/components/Home/WelcomeScreen.tsx b/client/src/components/Home/WelcomeScreen.tsx index 2a63a624d..3c77105e6 100644 --- a/client/src/components/Home/WelcomeScreen.tsx +++ b/client/src/components/Home/WelcomeScreen.tsx @@ -1,24 +1,40 @@ -import React, { useState, useCallback, useEffect } from 'react' -import { View, Text, Image, StyleSheet, Dimensions, TouchableOpacity, TouchableWithoutFeedback, Keyboard, Platform, KeyboardAvoidingView, SafeAreaView } from 'react-native'; -import { useFonts } from 'expo-font'; -import { Link, router } from 'expo-router'; -import * as SplashScreen from 'expo-splash-screen'; -import { WelcomeEmailInput } from '../Common/CustomInputs'; -import { AuthenticationErrorMessage, AuthenticationResponse, inValidEmailResponse } from '../Auth/AuthenticationResponse'; -import { FirebaseError } from 'firebase/app'; +import React, { useState, useCallback, useEffect } from "react"; +import { + View, + Text, + Image, + StyleSheet, + Dimensions, + TouchableOpacity, + TouchableWithoutFeedback, + Keyboard, + Platform, + KeyboardAvoidingView, + SafeAreaView, +} from "react-native"; +import { useFonts } from "expo-font"; +import { Link, router } from "expo-router"; +import * as SplashScreen from "expo-splash-screen"; +import { WelcomeEmailInput } from "../Common/CustomInputs"; +import { + AuthenticationErrorMessage, + AuthenticationResponse, + inValidEmailResponse, +} from "../Auth/AuthenticationResponse"; +import { FirebaseError } from "firebase/app"; const WelcomeScreen = () => { - const keyboardVerticalOffest = Platform.OS === "ios" ? 0 : 0; const keyboardBehavior = Platform.OS === "ios" ? "padding" : undefined; const [fontsLoaded, fontError] = useFonts({ - 'Gilroy-ExtraBold': require('../../../assets/fonts/Gilroy-ExtraBold.otf'), - 'Gilroy-Light': require('../../../assets/fonts/Gilroy-Light.otf'), + "Gilroy-ExtraBold": require("../../../assets/fonts/Gilroy-ExtraBold.otf"), + "Gilroy-Light": require("../../../assets/fonts/Gilroy-Light.otf"), }); - const [email, setEmail] = useState(''); - const [authResponse, setAuthResponse] = React.useState(); + const [email, setEmail] = useState(""); + const [authResponse, setAuthResponse] = + React.useState(); if (!fontsLoaded && !fontError) { return null; @@ -26,15 +42,17 @@ const WelcomeScreen = () => { const handleLogin = () => { const preparedEmail = email.trim(); - if ((preparedEmail.length !== 0) && isValidEmail(preparedEmail)) { - router.push( { pathname: '/login', params: { inputEmail: preparedEmail } } ); - setAuthResponse(undefined) + if (preparedEmail.length !== 0 && isValidEmail(preparedEmail)) { + router.push({ + pathname: "/login", + params: { inputEmail: preparedEmail }, + }); + setAuthResponse(undefined); } else { - console.log('Invalid email'); - setAuthResponse({user: undefined, error: inValidEmailResponse}) + console.log("Invalid email"); + setAuthResponse({ user: undefined, error: inValidEmailResponse }); } - } - + }; const isValidEmail = (email: string) => { const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; @@ -43,53 +61,65 @@ const WelcomeScreen = () => { return ( - - + - - - - - - + Welcome to Proximity Chat! - Login - setEmail(text)} /> - - - + setEmail(text)} + /> + + + - - setAuthResponse(undefined)} /> + setAuthResponse(undefined)} + /> - Don't have an account? Sign up! + Don't have an account?{" "} + + Sign up! + - - ) -} + ); +}; const styles = StyleSheet.create({ image: { @@ -120,10 +150,10 @@ const styles = StyleSheet.create({ display: "flex", flexDirection: "column", alignItems: "center", - height: '100%', - width: '100%', + height: "100%", + width: "100%", justifyContent: "flex-end", - + backgroundColor: "white", }, sub_container: { @@ -142,7 +172,6 @@ const styles = StyleSheet.create({ alignItems: "center", justifyContent: "space-evenly", minHeight: Dimensions.get("window").height * 0.35, - }, login_container: { @@ -188,8 +217,7 @@ const styles = StyleSheet.create({ link: { color: "#5dbea3", textDecorationLine: "underline", - } - + }, }); -export default WelcomeScreen +export default WelcomeScreen;