どのように反応ネイティブで要素を取得しますか?getElementById react-native
私のユースケースはログイン画面です。送信ボタンが押されたので、ユーザー名とパスワードのTextInputsの値を取得します。
export default class Login extends Component
{
login()
{
//document.getElementById('username'); //run-time error
}
render()
{
return (
<View style={{flex: 1,flexDirection: 'column',justifyContent: 'space-between',margin:10}}>
<View style={{backgroundColor: 'powderblue'}} />
<MyTextField id='user' placeholder="User Name" />
<MyTextField id='pass' placeholder="Password" />
<MyButton onPress={this.login} title='Login'/>
</View>
);
}
}
は –