Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

115
Views
Reaccionar nativo con Firebase v9

Soy nuevo en reaccionar nativo, estoy tratando de obtener los datos de mi base de datos de Firebase. Estoy tratando de enumerar el nombre y la edad de mi colección Firestore,

aquí está mi código:

 const HomeNurse=({ navigation }) => { const [users, setUsers] = useState([]); const [currentPage, setCurrentPage] = useState(1); const [isLoading, setIsLoading] = useState(false); const getUsers = async () => { let result = []; const querySnapshot = await getDocs(collection(db, "MyCollection")); querySnapshot.forEach((doc) => { console.log(doc.id, "=>" , doc.data()); result.push(doc.data()); }); setUsers([...result]); }; useEffect(() => { getUsers(); }, []); const renderItem = ({ item }) => { return ( <View> <View> <Text>{`${item.name}`}</Text> <Text>{`${item.age}`}</Text> </View> </View> ); }; const renderLoader = () => { return isLoading ? ( <View style={styles.loaderStyle}> <ActivityIndicator size="large" color="#aaa" /> </View> ) : null; }; const loadMoreItem = () => { setCurrentPage(currentPage + 1); }; return ( <View> <StatusBar backgroundColor="#000" /> <FlatList data={users} renderItem={renderItem} keyExtractor={(item) => item.id} ListFooterComponent={renderLoader} onEndReached={loadMoreItem} onEndReachedThreshold={0} /> </View> ); };

la salida es solo una pantalla en blanco con una advertencia:

Posible ID de rechazo de promesa no manejada: 0

en la terminal:

[Rechazo de promesa no manejado: TypeError: (0, _firebase.collection) no es una función. (En '(0, _firebase.collection)(_firebase.db, "MyCollection")', '(0, _firebase.collection)' no está definido)]

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!