below is what I have done
useEffect(() => {
database()
.ref(`/User/`)
.on('value', function(snapshot) {
const list = [];
snapshot.val(doc => {
const { name, email} = snapshot.val();
list.push({
id: doc.id,
name,
email,
});
});
setUsers(list);
setLoading(false);
console.log('User data: ', snapshot.val());
});
}, [userId]);
it shows the information from the database on the console, but it doesn't show on the app, doing this for firebase firestore works fine, but its not loading any information to the app page
below is how I have used flatlist and list.item tags to show the data from the database in the app
<FlatList
data={users}
ItemSeparatorComponent={() => <Divider />}
keyExtractor={item => item.id}
renderItem={({ item }) => (
<TouchableOpacity
onPress={() => navigation.navigate('Room', { thread: item })}
>
<List.Item
title={item.name}
description={item.email}
titleNumberOfLines={1}
titleStyle={styles.listTitle}
descriptionStyle={styles.listDescription}
descriptionNumberOfLines={1}
/>
</TouchableOpacity>
)}
/>
I am using the latest versions of react-native and firebase