Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
React-Native: Mark chat messages as read on backend

I'm working on a react-native chat with laravel backend (I'm using Laravel Websockets/Pusher).

In the backend I my messages model has a isRead boolean field, I'm having problems finding a way to correctly mark chat messages as read, for example when a user navigates to chat screen I fire axios to get messages and check if there are unread messages, then I mark them as read if needed.

But how can I mark as read messages that were sent when the receiving user was looking at the chat screen? Is there a client event for that, how can I deal with this?

My chat screen is a simple Flatlist.

<FlatList ref={flatListRef} 
              vertical={true} onScroll={handleScroll} onEndReachedThreshold={0.5} onEndReached={markChatMessagesAsRead} showsVerticalScrollIndicator={false} style={{ flex:1,padding:15}} data={messages} keyExtractor={item => item.id.toString()}
            renderItem={({ message, index }) => 
              <View  style={{width:'100%',flexDirection:'row', ...index == messages.length-1 ? {marginBottom:100} : {marginBottom:5}}}>
    <Text>{ message.body}</Text>
                   <Text>{ message.isRead }</Text>
              </View>}
            />
about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda