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

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

自从我从 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

以及之前有效的操作:

//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
        })
      );
  };
};

我已经尝试了许多其他方法来让它工作,但没有一个成功。我也没有在谷歌上发现任何特别 react native 的东西。有任何想法吗?

最佳答案

这是 react-native@0.54.2 上的错误。

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

关于javascript - react-native firebase 在类 com.facebook.react.bridge.ReadableNativeMap 上找不到要序列化的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50360629/

相关文章:

javascript - 为什么我的 AuthorButton 的 .on ("click") 函数每隔一个引用只返回我的变量?

JavaScript 可以在 Firefox 上运行,但不能在 Chrome 和 IE6 上运行

firebase - 900个字符的Firebase Auth idToken大小正常吗?

node.js - Firebase 函数在 Function.MapValues 处返回 RangeError

react-native - 使用放入回调

javascript - 跨域请求不适用于 Safari 中的 SoundCloud

javascript - 带有 ID 的 DOM 树元素会成为全局属性吗?

android - 为个人用户组织 Firebase 数据库,想法?

javascript - 状态未在 native react 中更新?

javascript - 如何链接 RCTCameraRoll for Android