Postingan lainnya
Buku Ini Koding!
Baru!
Buku ini akan jadi teman perjalanan kamu belajar sampai dapat kerjaan di dunia programming!
Kelas Premium!
Belajar Javascript untuk website
Gunakan kupon "mulaijs" untuk diskon 75 ribu!
Error ketika login email di firebase
1.PNG
2.PNG
import React, { useState, useEffect } from 'react';
import { View, Text, TextInput, TouchableOpacity, StatusBar, ScrollView } from 'react-native';
import auth from '@react-native-firebase/auth';
const Register = ({ navigation }) => {
const [email, setEmail] = useState()
const [password, setPassword] = useState()
function registrasi() {
auth()
.createUserWithEmailAndPassword(email, password)
.then(() => {
console.log('User account created & signed in!');
navigation.navigate('Home')
})
.catch(error => {
if (error.code === 'auth/email-already-in-use') {
console.log('That email address is already in use!');
console.log('Akun anda sudah pernah dibuat!')
}
if (error.code === 'auth/invalid-email') {
console.log('That email address is invalid!');
console.log('Email salah!')
}
console.error(error);
});
}
return (
<ScrollView style={{ backgroundColor: '#f7f6fd' }}>
<View style={{ flex: 1, backgroundColor: '#f7f6fd' }}>
<StatusBar backgroundColor={'#f7f6fd'} barStyle="dark-content" />
<View style={{ marginHorizontal: 40, marginTop: 80 }}>
<Text
style={{
fontSize: 22,
fontWeight: 'bold',
textAlign: 'center',
color: '#373248'
}}
>
Register
</Text>
<Text
style={{
textAlign: 'center',
marginBottom: 20,
color: '#868693',
marginTop: 5
}}
>
Buat akun baru, lengkapi data-data berikut!
</Text>
{ /\* username */}
<TextInput
value={email}
onChange={text => setEmail(text)}
style={{ backgroundColor: '#fff', elevation: 2, borderRadius: 6, paddingLeft: 15 }}
placeholder='Masukkan Email Anda'
keyboardType='email-address'
/>
{ /\* password */}
<TextInput
value={password}
onChange={text => setPassword(text)}
style={{ backgroundColor: '#fff', elevation: 2, borderRadius: 6, paddingLeft: 15, marginTop: 10 }}
placeholder='Masukkan Password Anda'
keyboardType='default'
secureTextEntry
/>
{ /\* Register */}
<TouchableOpacity
style={{
backgroundColor: '#303030',
paddingVertical: 14,
borderRadius: 6,
marginTop: 20,
elevation: 2
}}
onPress={() => registrasi()}
>
<Text style={{ color: '#fff', textAlign: 'center', fontWeight: 'bold' }}>
Register
</Text>
</TouchableOpacity>
<View style={{ flexDirection: 'row', marginTop: 10 }}>
{ /\* registrasi */}
<TouchableOpacity
style={{
paddingVertical: 14,
}}
onPress={() => navigation.navigate('Login')}
>
<Text style={{ color: '#373248', fontWeight: 'bold' }}>
Punya akun?
</Text>
</TouchableOpacity>
{ /\* lupa password */}
<TouchableOpacity
style={{
paddingVertical: 14,
marginLeft: 'auto'
}}
onPress={() => navigation.navigate('ForgotPassword')}
>
<Text style={{ color: '#373248', fontWeight: 'bold' }}>
Lupa password?
</Text>
</TouchableOpacity>
</View>
</View>
</View>
</ScrollView>
)
}
export default Register
1 Jawaban:
<div>Coba cek ini<br><a href="https://stackoverflow.com/questions/55084493/malformed-calls-from-js-field-sizes-are-different">https://stackoverflow.com/questions/55084493/malformed-calls-from-js-field-sizes-are-different</a></div>