aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Shillingford <jgs272@cornell.edu>2020-06-26 17:52:30 -0400
committerJustin Shillingford <jgs272@cornell.edu>2020-06-26 17:52:30 -0400
commit0095085e04666537935d37c49378677e14319912 (patch)
tree013801287f49fec1426ea8f58eb6f253d0e71663
parent978ae4debec6b5ab0fe239fb71d7f11a7d7798fd (diff)
Made the username and password stateful
-rw-r--r--App.tsx8
1 files changed, 8 insertions, 0 deletions
diff --git a/App.tsx b/App.tsx
index 70ff6a2d..dc5a9f77 100644
--- a/App.tsx
+++ b/App.tsx
@@ -38,6 +38,10 @@ declare const global: {HermesInternal: null | {}};
const App = () => {
const passwordInput = useRef();
+ const [data, setData] = React.useState({
+ username: '',
+ password: '',
+ })
return (
<>
@@ -65,6 +69,8 @@ const App = () => {
textContentType='username'
returnKeyType='next'
keyboardType='ascii-capable'
+ onChangeText={user => setData({...data, username: user})}
+ defaultValue={data.username}
onSubmitEditing={() => {passwordInput.current.focus()}}
blurOnSubmit={false}
/>
@@ -77,6 +83,8 @@ const App = () => {
autoCompleteType='password'
textContentType='password'
returnKeyType='go'
+ onChangeText={pass => setData({...data, password: pass})}
+ defaultValue={data.password}
onSubmitEditing={() => Alert.alert("My favorite Girl Scout Cookies are taggalongs!")}
ref={passwordInput}
secureTextEntry={true}