相关疑难解决方法(0)

React native - 对象无效作为React子对象(找到:具有键{$$ typeof,type,key,ref,props,_owner,_store}的对象)

我是React Native的新手,我在下面引用了一个错误:

对象无效作为React子对象(找到:具有键{$$ typeof,type,key,ref,props,_owner,_store}的对象).如果您要渲染子集合,请使用数组.

这是我的整个代码包含在组件文件中,除了样式:

import React, { Component } from 'react';
import { View, Text, TextInput, TouchableOpacity, Image, StyleSheet } from 'react-native';
import firebase from 'firebase';

class LoginForm extends Component {

    state = { email: '', password: '', error: '', loading: false };

    onButtonPress(){
        const email = this.state.email;
        const password = this.state.password;

        this.setState({error: '', loading: true});

        firebase.auth().signInWithEmailAndPassword(email, password)
            .then(this.onLoginSuccess.bind(this))
            .catch(() => {
                firebase.auth().createUserWithEmailAndPassword(email, password)
                .then(this.onLoginSuccess.bind(this))
                .catch(this.onLoginFail.bind(this));
            });
    }

    onLoginSuccess(){
        this.setState({email: '', password: '', error: '', loading: false});
    }

    onLoginFail(){ …
Run Code Online (Sandbox Code Playgroud)

javascript android reactjs react-native

26
推荐指数
4
解决办法
1万
查看次数

标签 统计

android ×1

javascript ×1

react-native ×1

reactjs ×1