diff options
author | Justin Shillingford <jgs272@cornell.edu> | 2020-06-26 17:52:30 -0400 |
---|---|---|
committer | Justin Shillingford <jgs272@cornell.edu> | 2020-06-26 17:52:30 -0400 |
commit | 0095085e04666537935d37c49378677e14319912 (patch) | |
tree | 013801287f49fec1426ea8f58eb6f253d0e71663 /App.tsx | |
parent | 978ae4debec6b5ab0fe239fb71d7f11a7d7798fd (diff) |
Made the username and password stateful
Diffstat (limited to 'App.tsx')
-rw-r--r-- | App.tsx | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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} |