Tengo una función en la que obtengo datos de Firestore, me gustaría mostrar los datos de la función en una lista de secciones en React Native. Este es mi código:
La consulta:
function EntryDate() { firebase .firestore() .collection("journal") .doc(currentUserUID) .collection("entry") .get() .then((querySnapshot) => { querySnapshot.forEach((entry) => { const { title, createdAt, getMonth, getDay, sortTime } = entry.data(); }); }); }La variable donde paso la función:
const DATA = [ { title: EntryDate(), data: todos, }, ];y donde quiero que regresen los datos:
<SectionList style={{ marginLeft: 15 }} sections={DATA} keyExtractor={(item) => item.id} renderItem={({ item }) => <TextLog {...item} />} renderSectionHeader={({ section: { title } }) => <Text>{title}</Text>} />