Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

214
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda