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 12:13:01 -0400
commit7b9a93463797ee6a90abb2c02fa3cffcfc613c32 (patch)
tree22c8db4f636938d8fddc1c303856611dc16d0888
parent6b5b9c6d9d99f43f83185fdd25c3bbfcdf7f1587 (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}
/>