背景通過が
私はReact Native
アプリケーションで作業していると私は、ログインフォームを持っているの状態にネイティブ入力フィールドを反応します。ログインフォームinput
は、button click
にメールを送信しています。 私はconsole.logにメールフィールドをしようとしています。 this.state.email
しかし、私は電子メールを取得し続けています。
私は読みやすいようにfirebase関数を削除しました。しかしフォームの上部にはconsole.log
は決して成功しません。
例
これらは、私が働いているコンポーネントです。
入力コンポーネント
この入力コンポーネントは、LoginFormに使用されます。
class Input extends Component {
constructor(props) {
super(props);
this.state = {
value: '',
onChangeText: ''
}
}
render() {
return(
<View}>
<Text>{this.props.label}</Text>
<TextInput
value={this.value}
onChangeText={this.onChangeText}
/>
</View>
);
}
}
LoginFormコンポーネント
class LoginForm extends Component {
constructor(props) {
super(props);
this.state = {
email: '',
};
}
signIn() {
console.log(this.state.email);
}
render() {
return(
<Card>
<CardSection>
<Input
value={this.state.email}
onChangeText={(email) => this.setState({email})}
/>
</CardSection>
<CardSection>
<Button
onPress={() => this.signIn()}
btnTxt='Sign In'
/>
</CardSection>
</Card>
);
}
質問ので、私は私のFirebase
認証で使用することができますstate
に入力フィールド "電子メール" を渡すために適切な方法は何ですか
関数?