React Nativeで作成したアプリケーションのレジストリ画面で作業しています。 Firebase認証を使用して新しいユーザを作成しています。React Native + Firebase Auth - displayName
ログイン画面で、私はアカウントにアクセスするために.signInWithEmailAndPasswordを使用しています。登録画面では、(ユーザーを作成するために).createUserWithEmailAndPasswordを使用しています。また、Firebase認証に関する記事を読むと、 displayNameを使用して名前userを受け取り、photoUrlを使用してユーザーの写真を受け取ることができます。
私がしたいのは、ユーザー名、電子メール、パスワードを使って新しいユーザーを作成することです。被験者の記事を読んでも、私はこれを行う方法を知らない。
これは私のコードです:
signup() {
this.setState({
// When waiting for the firebase server show the loading indicator.
loading: true
});
// Make a call to firebase to create a new user.
this.props.firebaseApp.auth().createUserWithEmailAndPassword(this.state.email, this.state.password).then((userData) => {
// then and catch are methods that we call on the Promise returned from
// createUserWithEmailAndPassword
Alert.alert('Success', 'Congrats!', [{text: 'OK!', onPress: this.dismiss}]);
this.setState({
// Clear out the fields when the user logs in and hide the progress indicator.
email: '',
password: '',
loading: false
});
AsyncStorage.setItem('userData', JSON.stringify(userData));
this.props.navigator.push({
component: Account
});
}).catch((error) => {
// Leave the fields filled when an error occurs and hide the progress indicator.
this.setState({
loading: false
});
Alert.alert('Ops', 'Error: ' + error.message, [{text: 'OK!', onPress: this.dismiss}]);
});
}
基本的に私はFirebase認証を使用して、ユーザー名、メールアドレスとパスワードを使用して新しいユーザーを作成します。
ユーザー名、電子メール、パスワードを使用してユーザーを作成する方法の例を教えていただけますか?
私がしようとしていることを見たい場合は、React Nativeで自分の知識を向上させるプロジェクトを作成しましたか? https://github.com/JoaoVRodrigues01/React-Native-Codec-App
お返事ありがとうございます。ログイン画面では、ユーザーは電子メールとパスワードを使用してアカウントに入り、登録画面でユーザーは名前、電子メール、およびパスワードを使用してアカウントを作成します。私は、レジストリのユーザー名を画面に表示するためにユーザー名を要求したい場合、ユーザー名や電子メールなどのユーザーアカウント情報が表示されます。 –
申し訳ありませんが、私はあなたのユースケースを理解していません。 – bojeil
基本的には、Firebase認証を使ってユーザー名、電子メール、パスワードでユーザーを作成したいと考えています。でも問題ない。とにかくありがとうございました! –