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

218
Views
React Native: onViewableItemsChanged: check last item is visible on screen

In my react-native app I'm using onViewableItemsChanged prop on FlatList in order to see if the last item of FlatList is visible on screen,.

To do that I want to compare changed item indexes with the number of items in FlatList, however messages.length is always zero even though it's not, I think I'm getting the length of messages array on mount which is zero.

How would you go about this problem?

const onViewRef = React.useRef((viewableItems)=> {
                //This always returns 0 so how can I check if last item is on screen
                console.log('messagesTotal:',messages.length);
                console.log('changedItems:',viewableItems.changed[0].index);
                
                setValue(viewableItems.changed[0].index);
            });
<FlatList ref={flatListRef} onViewableItemsChanged={onViewRef.current}>
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!