I am stuck with a very simple problem. I have login form with username, password and button. In my button handler, I try to get the textinput value. But always get undefined
You should use States to store the value of input fields. https://facebook.github.io/react-native/docs/state.html
setState
onChangeText={(value) => this.setState({username: value})}
this.state.username
Sample code
export default class Login extends Component {
state = {
username: 'demo',
password: 'demo'
};
User Name
this.setState({username: value})}
value={this.state.username}
/>
Password
this.setState({password: value})}
value={this.state.password}
/>