I have a TextInput below : Normally I am able to read TextInput when there is a change , the problem is the TextInput for password is populated with a default password . So the user may not need to edit(change) it - therefore not triggering onChangeText method .
import React,{Component} from 'react' import {View, Text, TextInput } from 'react-native' export default class App extends Component { constructor(props){ super(props); this.state = { username: '', password: 12345 } } onChangeText = (key, val) => { this.setState({ [key]: val}) } render() { return ( <View style={styles.container}> <Text>Login Form</Text> <TextInput placeholder='Username' onChangeText={val => this.onChangeText('username', val)} style={styles.input} value={this.state.username} /> <TextInput placeholder='Password' onChangeText={val => this.onChangeText('password', val)} style={styles.input} value={this.state.password} secureTextEntry={true} /> </View> ); } } Now , my question is how do I read TextInputs which are not being changed ?
this.state.passwordat the place you are making API call. For example something like this...login(this.state.username, this.state.password). You should show API call code, to get exact answer.document.getElementById('passwordInput').value?