react-native firebase没有在类com.facebook.react.bridge.ReadableNativeMap上找到的序列化属性

时间:2018-05-15 23:49:33

标签: javascript firebase react-native react-native-firebase

Eversince我从firebase web SDK切换到react-native-firebase,在注册用户后我无法在数据库上创建用户节点。我收到以下错误(在Windows上):

https://i.imgur.com/sddZEeY.png

在Mac上,我运行Android,该应用程序没有崩溃,但它没有在数据库上设置节点。但是,它适用于iOS。

取自package.json:

   "react-native": "0.54.2"
   "react-native-firebase": "^4.1.0"

在我的android build.gradle中,我有:



dependecies{
...
    implementation "com.google.android.gms:play-services-base:15.0.0"
    implementation "com.google.firebase:firebase-core:15.0.2"
    implementation "com.google.firebase:firebase-auth:15.1.0"
    implementation "com.google.firebase:firebase-messaging:15.0.2"
    implementation "com.google.firebase:firebase-database:15.0.0"
}

Tested only on android.




其余的信息。调试器中未显示错误。



No properties to serialize found on class com.facebook.react.bridge.ReadableNativeMap
<init>
    null
zza
    null
zzi
    null
zzh
    null
zza
    null
setValue
    null
set
    RNFirebaseDatabase.java:332
invoke
    Method.java
invoke
    JavaMethodWrapper.java:374
invoke
    JavaModuleWrapper.java:162
run
    NativeRunnable.java
handleCallback
    Handler.java:751
dispatchMessage
    Handler.java:95
dispatchMessage
    MessageQueueThreadHandler.java:31
loop
    Looper.java:154
run
    MessageQueueThreadImpl.java:194
run
    Thread.java:761
&#13;
&#13;
&#13;

之前有效的行动:

&#13;
&#13;
//register
export const registerUser = (
  {
    userName, //name of the user
    userEmail, //email of the user
    password //pw of the user
  },
  onSuccess, //callback()
  onFail // callback(showDialog[bool], { dialogTitle, dialogBody })
) => {
  console.log("register user", userEmail, password);
  return dispatch => {
    firebase
      .auth()
      .createUserWithEmailAndPassword(userEmail, password)
      .then(user => {
        console.log("registering user.uid: ", user.uid);
        firebase
        .database()
        .ref(`${DBREF_USERS}${user.uid}`)
        .set({
          name: userName,
          email: userEmail,
          id: user.uid
        }, 
        dispatch({
          type:REGISTER_SUCCESS,
          payload: user.uid
        }))
        onSuccess();
      })
      .catch(error =>
        onFail(true, {
          dialogTitle: I18n.t("alert_dialog_title"),
          dialogBody: error.message
        })
      );
  };
};
&#13;
&#13;
&#13;

我已经尝试了许多其他方法来使其发挥作用,但没有一种方法能够发挥作用。我还没有在google上找到任何特别反应原生的东西。有任何想法吗?

1 个答案:

答案 0 :(得分:2)

这是react-native@0.54.2的错误。

升级到react-native@0.54.4或更高版本以解决此问题。