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

196
Views
Reaccionar mensajes de grupo nativos de firebase por marca de tiempo

Estoy tratando de agrupar mensajes por marca de tiempo, tal como lo hace WhatsApp, estoy usando firestore db para almacenar mensajes y el esquema de mi mensaje es el siguiente:

 interface MessageType { id: string; roomId: string; text: string; sentBy: string; createdAt: Timestamp; user: User; }

Intenté lo siguiente y obtuve un poco lo que necesitaba pero hay algunos problemas, he compartido un enlace a la pantalla de chat, allí puedes ver lo que está sucediendo, cuando entro en la sala de chat, aparecen como un milisegundo y desaparece, luego, si presiono ctrl + s, aparece la marca de tiempo, pero se muestran en el lugar equivocado (deberían mostrarse en la parte superior, pero se muestran en la parte inferior del último mensaje de ese día en particular, ya que estoy usando prop invertida en Flatlist ), además, cuando presiono ctrl+s (observe el rendering... en la parte inferior) el último mensaje ( cmoooon ) desaparece como se puede ver en el video.

 const ChatScreen = () => { const dates = new Set(); const [messages, setMessages] = useState([]); ... return <FlatList inverted data={[...messages].reverse()} keyExtractor={(item: MessageType) => item.id} renderItem={({ item }) => renderItem({ item, user, dates })} /> } const renderItem = ({item, user, dates}) => { const isSameDate = dates.has(item?.createdAt?.toDate().toDateString()); if (!isSameDate) { dates.add(item?.createdAt?.toDate().toDateString()); return <DateItem time={item?.createdAt?.toDate().toDateString()} /> } return <MessageItem data={item} key={item.id} myId={user.uid} />; };

Enlace de vídeo: https://drive.google.com/file/d/1_h5742ObC9rBOqvBCZgrhJV9vWK1b9xz/view?usp=sharing

¿Puede alguien ayudarme con esto?

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!