我是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) 我收到如下所示的错误:
com.google.firebase.database.DatabaseException:com.example.admin.albumsviewer.Album$Info 类未定义无参数构造函数。如果您使用 ProGuard,请确保这些构造函数没有被剥离。
事实上,在我的模型类中,我已经声明了无参数构造函数:
package com.example.admin.albumsviewer;
import java.util.ArrayList;
import java.util.List;
public class Album {
String nazwa;
String wykonawca;
String okladkaAlbumu;
String logoZespolu;
Info info;
Utwory utwory;
public String getNazwa() {
return nazwa;
}
public void setNazwa(String nazwa) {
this.nazwa = nazwa;
}
public String getWykonawca() {
return wykonawca;
}
public void setWykonawca(String wykonawca) {
this.wykonawca = wykonawca;
}
public String getOkladkaAlbumu() {
return okladkaAlbumu;
}
public void setOkladkaAlbumu(String okladkaAlbumu) {
this.okladkaAlbumu = okladkaAlbumu;
}
public String getLogoZespolu() {
return …Run Code Online (Sandbox Code Playgroud)