firebase – React Native IOS app cannot talk to firestore


I was developing a react native ios app. However, it seems there are some problems in connecting with firestore database. Below are my codes and some screenshots.

export default function Landing({navigation}) {
  const user = async() => {firestore().collection('lulu').doc('wwweee').get().then(documentSnapshot => {
    console.log('User exists: ', documentSnapshot.exists);})}
  return (
    <View style={{flex: 1, justifyContent: 'center',backgroundColor:'white'}}>
        <Button title="Login" 
                onPress={() => navigation.navigate("Login")}/>    
    </View>
  )
}

The log didn’t print anything. But I do have some data in the firestore cloud database:

Firestore database

After I login, I ran the code:

firestore().collection("lulu").doc('test').set({name:"text"})

Then I have:

terminal

Once I change a user to login, the data will be gone. It seems the data save/retrieve with the user when logging in rather than global database. Even though I ran the above code to save doc ‘test’ with name “text”. The database still didn’t change at all.

I don’t know where is the problem. I followed the instructions when creating an APP in firestore step-by-step.

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img