简体   繁体   中英

How to use Firestore with React-native?

I am currently using

@React-native 0.61.4

and

@firebase 7.4.0

Functions like

Firebase.auth()

seems to work ok but when I use

Firebase.firestore()

nothing happens. This is my code:

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

};

It does not enter the then() and print the dots nor enter() the catch and print the error. I have also tried other options like react-native-firebase and that nether works because of the version of ios 13 and react-native

Use @react-native-firebase/firestore instead.

It's an abstraction on @firebase/firestore. See guide here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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