diff options
author | Justin Shillingford <jgs272@cornell.edu> | 2020-06-29 12:13:01 -0400 |
---|---|---|
committer | Justin Shillingford <jgs272@cornell.edu> | 2020-06-29 14:25:38 -0400 |
commit | c1a499812c555393c4cca503a7f4b8582ae00e69 (patch) | |
tree | cf700f060eadd97c409a91e9b1e65a309a5b5f32 /App.tsx | |
parent | 10f04b0610e439a31eb97ba71bc6cfb16520f86e (diff) |
Removed useless validUserCheck method
Also commented the methods
Diffstat (limited to 'App.tsx')
-rw-r--r-- | App.tsx | 27 |
1 files changed, 9 insertions, 18 deletions
@@ -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} /> |