diff options
author | Justin Shillingford <jgs272@cornell.edu> | 2020-06-26 17:52:30 -0400 |
---|---|---|
committer | Justin Shillingford <jgs272@cornell.edu> | 2020-06-29 14:25:38 -0400 |
commit | a0d29d2d7eb2895e9dced2f566f4df4cd91fce1f (patch) | |
tree | 737f0b49271224f483509a57e551adc9208ab044 /App.tsx | |
parent | d08c8cb9dce1dc131325efa93f6b43093dfe81df (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} |