I am trying to build a very basic LogIn screen atm as a starter project for the future.
All is done in TypeScript and React Native.
When i try to use OnChangeText function, email is not set to the value that was put into the field and the console.log remains "I am [object Object]"
How do i parse the input value correctly into the variable to use properly in the upcoming code?
sorry for this very basic question, i followed a tutorial that was more or less frontend only and now it seems i am stuck with the first step of the backend :/
If i understand it right, the useState hook should declare email as a string (hence the '') and then use setEmail to enter the given value into email. The (email) that is given with onCahngeText is not this variable but the value of the inputfield?
export default function App() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); return (<LoginWrapper><Text>Enter UserName</Text><LoginInput style={styles.text} placeholder="username/email" onChangeText={(email) => { setEmail(email) console.log("I am " + email) }} /><Text>Enter Password</Text><LoginInput style={styles.text} secureTextEntry placeholder="Password" onChangeText={(password) => setPassword(password)} /></LoginWrapper> );}
EDIT: i found it to be working half right now with changing the name of the input from email to input
onChangeText={(input) => { setEmail(input) }}
but the mobile keyboard closes after a single value is put in. I can´t write "Hello", as only "H" gets through. Is this maybe jsut a sideeffect of using Expo?