From cc98da27fac18ba8060bc7fa76ce13624d452543 Mon Sep 17 00:00:00 2001 From: Justin Shillingford Date: Thu, 25 Jun 2020 17:21:04 -0400 Subject: Added base app with background color for Sign In Everything's in App.tsx for now since we haven't discussed structure --- ios/Podfile.lock | 10 ++- package.json | 1 + src/routes/Routes.tsx | 2 +- src/screens/Login.tsx | 225 ++++++++++++++++++++++++++++++++++++++++++++++++-- yarn.lock | 35 ++++---- 5 files changed, 246 insertions(+), 27 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 693e204c..fcff1410 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,5 +1,7 @@ PODS: - boost-for-react-native (1.63.0) + - BVLinearGradient (2.5.6): + - React - CocoaAsyncSocket (7.6.4) - CocoaLibEvent (1.0.0) - DoubleConversion (1.1.6) @@ -233,7 +235,7 @@ PODS: - React-cxxreact (= 0.62.2) - React-jsi (= 0.62.2) - React-jsinspector (0.62.2) - - react-native-safe-area-context (3.0.6): + - react-native-safe-area-context (3.0.7): - React - React-RCTActionSheet (0.62.2): - React-Core/RCTActionSheetHeaders (= 0.62.2) @@ -307,6 +309,7 @@ PODS: - Yoga (~> 1.14) DEPENDENCIES: + - BVLinearGradient (from `../node_modules/react-native-linear-gradient`) - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`) @@ -376,6 +379,8 @@ SPEC REPOS: - YogaKit EXTERNAL SOURCES: + BVLinearGradient: + :path: "../node_modules/react-native-linear-gradient" DoubleConversion: :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" FBLazyVector: @@ -439,6 +444,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c + BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872 CocoaAsyncSocket: 694058e7c0ed05a9e217d1b3c7ded962f4180845 CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2 @@ -463,7 +469,7 @@ SPEC CHECKSUMS: React-jsi: b6dc94a6a12ff98e8877287a0b7620d365201161 React-jsiexecutor: 1540d1c01bb493ae3124ed83351b1b6a155db7da React-jsinspector: 512e560d0e985d0e8c479a54a4e5c147a9c83493 - react-native-safe-area-context: e22a8ca00f758273d2408953965cb8db67da7925 + react-native-safe-area-context: ef6f16c66b0797ecae1bf86c103dfb3dc16fc33d React-RCTActionSheet: f41ea8a811aac770e0cc6e0ad6b270c644ea8b7c React-RCTAnimation: 49ab98b1c1ff4445148b72a3d61554138565bad0 React-RCTBlob: a332773f0ebc413a0ce85942a55b064471587a71 diff --git a/package.json b/package.json index d3ad6c4d..0c8f7bf1 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "react": "16.11.0", "react-native": "0.62.2", "react-native-gesture-handler": "^1.6.1", + "react-native-linear-gradient": "^2.5.6", "react-native-reanimated": "^1.9.0", "react-native-safe-area-context": "^3.0.6", "react-native-screens": "^2.9.0" diff --git a/src/routes/Routes.tsx b/src/routes/Routes.tsx index 9c2efada..0b08cbb1 100644 --- a/src/routes/Routes.tsx +++ b/src/routes/Routes.tsx @@ -15,7 +15,7 @@ interface RoutesProps {} const Routes: React.FC = ({}) => { return ( - + ); diff --git a/src/screens/Login.tsx b/src/screens/Login.tsx index 0305b907..672fd035 100644 --- a/src/screens/Login.tsx +++ b/src/screens/Login.tsx @@ -1,9 +1,19 @@ -import React from 'react'; +import React, { useRef } from 'react'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; -import {View, Text, Button} from 'react-native'; +import { + View, + Text, + Alert, + StatusBar, + Image, + TextInput, + TouchableOpacity, + StyleSheet +} from 'react-native'; import {RootStackParams} from '../routes'; +import LinearGradient from 'react-native-linear-gradient'; type LoginScreenRouteProp = RouteProp; type LoginScreenNavigationProp = StackNavigationProp; @@ -13,15 +23,212 @@ interface LoginProps { navigation: LoginScreenNavigationProp; } const Login = ({navigation}: LoginProps) => { + const passwordInput = useRef(); + const [data, setData] = React.useState({ + username: '', + password: '', + isValidUser: true, + isValidPassword: true, + }) + + /* + Updates the state of username. Also verifies the input of the Username field. + */ + const handleUsernameUpdate = (val:string) => { + var validLength:boolean = val.trim().length >= 6 + + if (validLength) { + setData({ + ...data, + username: val, + isValidUser: true + }) + } + else { + setData({ + ...data, + username: val, + isValidUser: false + }) + } + } + + /* + Updates the state of password. Also verifies the input of the Password field. + */ + const handlePasswordUpdate = (val:string) => { + var validLength:boolean = val.trim().length >= 8 + + if (validLength) { + setData({ + ...data, + password: val, + isValidPassword: true + }) + } + else { + setData({ + ...data, + password: val, + isValidPassword: false + }) + } + } + + /* + Handler for the Let's Start button or the Go button on the keyboard. + */ + const handleLogin = () => { + if (data.isValidUser && data.isValidPassword) { + Alert.alert(`My favorite Girl Scout Cookies are taggalongs! What are yours ${data.username}?`) + navigation.navigate('Registration') + } + } + return ( - - Welcome to Tagg! Login page goes here. -