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

182
Views
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
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!