I am getting this error -
"Objects are not valid as a React child (found: object with keys {$$typeof , type, key, ref, props, _owner, _store}). If you meant to render a collection of children, use an array instead"
This is specifically running the Android Emulator.
Here's my code:
export default class App extends Component {
constructor(props) {
super(props)
this.state = {
userEmail: null
}
//this.authCheck = this.authCheck.bind(this)
//this.toggleLogin = this.toggleLogin.bind(this)
this.signIn = this.signIn.bind(this)
}
componentDidMount() {
this.authListener()
}
authListener() {
firebase.auth().onAuthStateChanged((user) => {
if (user) {
console.log(user.email)
this.setState({userEmail: user.email})
} else {
console.log('no user signed in')
this.setState({userEmail: null})
}
})
}
signIn(email, password) {
//console.log(email, password)
//console.log(this.state.userEmail)
firebase.auth().signInWithEmailAndPassword(email, password)
.catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
console.log(errorCode, errorMessage)
// ...
})
}
signUp(email, password) {
firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
console.log(errorCode, errorMessage)
// ...
})
}
logOut() {
firebase.auth().signOut()
}
render() {
return (
<View style={styles.container}>
{this.state.userEmail ? <ItWorked logOut={this.logOut}/> : <SignUp signIn={this.signIn} signUp={this.signUp} toggleLogin={this.toggleLogin}/>}
</View>
);
}
}
ItWorkedandSignUpare implemented, since that's all that is rendered. - Tholle