繁体   English   中英

如何将 Firestore 与 React-native 一起使用?

[英]How to use Firestore with React-native?

我目前正在使用

@React-native 0.61.4

@firebase 7.4.0

像这样的功能

Firebase.auth()

似乎工作正常,但当我使用

Firebase.firestore()

什么都没发生。 这是我的代码:

import Firebase from 'firebase';

export const fetchUser = (userId) => async dispatch => {

    await Firebase.firestore()
        .collection('users')
        .doc(userId)
        .get()
        .then(doc => {
        alert('.............')

    }).catch(error => console.log(JSON.stringify(error)));

};

它不会进入 then() 并打印点,也不会 enter() 捕获并打印错误。 我还尝试过其他选项,例如 react-native-firebase 并且由于 ios 13 和 react-native 的版本,下界可以工作

请改用@react-native-firebase/firestore。

这是@firebase/firestore 的抽象。 请参阅此处的指南

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM