Sometimes the app working well. but I dont know why, sometimes the data from firebase give me blank screen instead of the data. after I reopen the app it work.
for example, one of my pages:
useEffect( () => {
        const subscriber =  firestore()
          .collection('Trails')
          .onSnapshot(querySnapshot => { //const querySnapshot = await firebase.firestore().collection('users').get();
            const trails = [];
            console.log('subscribe')
            if (querySnapshot)
              querySnapshot.forEach(async documentSnapshot => {
                trails.push({
                  ...documentSnapshot.data(),
                  key: documentSnapshot.id,
                });
                console.log("trails test", trails)
                
              });
            
            setTrails(trails);
            setLoading(false);
          });
        return () => {subscriber()};
      }, []);
I made useEffect to get the data from DB then show it, and same - sometimes give me blank and sometimes works well.
I want to publish the app but im not satisfying with this bug?
sorry for my English, I dont even know how to describe this problem better.
Please can anyone guide me through? maybe my useEffect not doing well?
 
     
    