From 7b9a93463797ee6a90abb2c02fa3cffcfc613c32 Mon Sep 17 00:00:00 2001 From: Justin Shillingford Date: Mon, 29 Jun 2020 12:13:01 -0400 Subject: Removed useless validUserCheck method Also commented the methods --- App.tsx | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/App.tsx b/App.tsx index 8eb4efea..a5fd3040 100644 --- a/App.tsx +++ b/App.tsx @@ -45,23 +45,9 @@ const App = () => { isValidPassword: true, }) - const validUserCheck = (val:string) => { - var validLength:boolean = val.trim().length >= 6 - - if (validLength) { - setData({ - ...data, - isValidUser: true - }); - } - else { - setData({ - ...data, - isValidUser: false - }) - } - } - + /* + Updates the state of username. Also verifies the input of the Username field. + */ const handleUsernameUpdate = (val:string) => { var validLength:boolean = val.trim().length >= 6 @@ -81,6 +67,9 @@ const App = () => { } } + /* + Updates the state of password. Also verifies the input of the Password field. + */ const handlePasswordUpdate = (val:string) => { var validLength:boolean = val.trim().length >= 8 @@ -100,6 +89,9 @@ const App = () => { } } + /* + 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}?`) @@ -134,7 +126,6 @@ const App = () => { keyboardType='ascii-capable' onChangeText={user => handleUsernameUpdate(user)} defaultValue={data.username} - onEndEditing={(val) => validUserCheck(val.nativeEvent.text)} onSubmitEditing={() => {passwordInput.current.focus()}} blurOnSubmit={false} /> -- cgit v1.2.3-70-g09d2