Reputation: 31
Im trying to display the contents of my firestore database, its working perfectly on ios but android is null, i've followed the instructions on https://rnfirebase.io/ for the android set up to the T and i've created multiple new apps to no avail.
Firebase is acknowledging that there are 2 apps connected but no matter what I do, nothing is being shown.
Ive updated the rules to accept any connections but still nothing. Has anyone else run into this problem? Any information needed can be provided, but seeing as the app is working fine on ios i'm going crazy trying to figure out whats wrong
export default function Products(){
const [loading, setLoading] = useState(true);
const [products, setProducts] = useState([]);
useEffect(() => {
const subscriber = firestore()
.collection('products')
.onSnapshot(querySnapshot => {
const products = [];
querySnapshot.forEach(documentSnapshot => {
products.push({
...documentSnapshot.data(),
key: documentSnapshot.id,
});
});
setProducts(products);
setLoading(false);
});
return () => subscriber();
}, []);
return(
<View>
<Text>Top</Text>
<FlatList
data={products}
renderItem={({ item }) => (
<View style={{height: 50, flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text>Product ID: {item.key}</Text>
<Text>Product Name: {item.name}</Text>
</View>
)}
/>
<Text>Bottom</Text>
</View>
);
}
Upvotes: 0
Views: 390
Reputation: 31
Damn, the internet on the android emulator wasn't working (can see in the picture the little x by the wifi cone), followed this post Android Studio - Android Emulator Wifi Connected with No Internet
Make sure to delete and reinstall the emulator and you'll be good to go
Upvotes: 1