我是React Native的初学者。我有问题,但是我不明白自己在做什么错。
这是我的代码:
import React, {Component} from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
} from 'react-native';
import {Button,Input} from 'react-native-elements';
import firebase from './screens/firebase';
console.log(firebase.name);
console.log(firebase.database());
class App extends React.Component
{
constructor(props)
{
super(props);
this.state = ({
name:'',
email : '',
Password : '',
id:'',
phone:'',
})
}
signup = (name,email,Password,id,phone) =>
{
try
{
firebase.auth().createUserWithEmailAndPassword(name,email,Password,id,phone)
}
catch(error)
{
console.log(error.toString())
}
alert('signUp Successful')
}
render()
{
return(
<View style = {styles.container}>
<Input
placeholder='Enter Name'
onChangeText={(name) => this.setState({name})}/>
<Input
placeholder='Enter Email'
onChangeText={(email) => this.setState({email})}/>
<Input
placeholder='Enter Password'
onChangeText={(Password) => this.setState({Password})}/>
<Input
placeholder='Enter id'
onChangeText={(id) => this.setState({id})}/>
<Input
placeholder='Enter Phone'
onChangeText={(phone) => this.setState({phone})}/>
<View style={{marginTop : 40,flexDirection : 'row'}}>
<Button
title="Sign UP"
onPress = {() => this.signup(this.state.name,this.state.email,this.state.Password,this.state.id,this.state.phone)}/>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container :
{
flex : 1,
justifyContent : 'center',
alignItems : 'center',
}
});
export default App;
有一个编译器错误,显示为:
永久违反:文本字符串必须在组件内呈现
我在哪里出错?我已经处理这个问题很长时间了,谢谢您的帮助。