import React, {useState, useEffect} from 'react' import { Button, Text, View, StyleSheet} from 'react-native' import {FlatList, ListViewBase } from 'react-native' import {TouchableOpacity} from 'react-native-gesture-handler' import {List, Divider} from 'react-native-paper' import Loading from './Loading' import firebase from 'firebase'; import { styles } from "../config/styles"; import { TextInput, TouchableWithoutFeedback, Keyboard, ImageBackground} from "react-native"; export default function Home_page({navigation}) { const [threads, setThreads] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { const fire = firebase.firestore() .collection('THREADS') .onSnapshot(querySnapshot => { const threads = querySnapshot.docs.map(documentSnapshot => { return{ _id:documentSnapshot.id, name:'', ...documentSnapshot.data() }; }); setThreads(threads); if(loading){ setLoading(false); } }); return () => fire(); }, []); if (loading) { return ; } return ( item._id} ItemSeparatorComponent={() => } renderItem = {({item}) => ( navigation.navigate('Room', {thread: item})} > )} />