From a0d29d2d7eb2895e9dced2f566f4df4cd91fce1f Mon Sep 17 00:00:00 2001 From: Justin Shillingford Date: Fri, 26 Jun 2020 17:52:30 -0400 Subject: Made the username and password stateful --- App.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'App.tsx') 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} -- cgit v1.2.3-70-g09d2