aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Shillingford <jgs272@cornell.edu>2020-06-29 12:13:01 -0400
committerJustin Shillingford <jgs272@cornell.edu>2020-06-29 14:25:38 -0400
commitc1a499812c555393c4cca503a7f4b8582ae00e69 (patch)
treecf700f060eadd97c409a91e9b1e65a309a5b5f32
parent10f04b0610e439a31eb97ba71bc6cfb16520f86e (diff)
Removed useless validUserCheck method
Also commented the methods
-rw-r--r--App.tsx27
1 files 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}
/>