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

289
Views
React-Native otro contenedor respaldado por VirtualizedList

Después de actualizar a react-native 0.61, recibo muchas advertencias como esa:

 VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead.

¿Cuál es el otro VirtualizedList-backed container que debo usar y por qué ahora se recomienda no usarlo así?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Si alguien todavía está buscando una sugerencia para el problema que @Ponleu y @David Schilling han descrito aquí (con respecto al contenido que va por encima de FlatList), entonces este es el enfoque que tomé:

 <SafeAreaView style={{flex: 1}}> <FlatList data={data} ListHeaderComponent={ContentThatGoesAboveTheFlatList} ListFooterComponent={ContentThatGoesBelowTheFlatList} /> </SafeAreaView>

Puede leer más sobre esto aquí: https://facebook.github.io/react-native/docs/flatlist#listheadercomponent

Espero que ayude a alguien. :)

over 4 years ago · Santiago Trujillo Report

0

En caso de que esto ayude a alguien, así es como solucioné el error en mi caso.

Tenía una FlatList anidada dentro de ScrollView :

 render() { return ( <ScrollView> <Text>{'My Title'}</Text> <FlatList data={this.state.myData} renderItem={({ item }) => { return <p>{item.name}</p>; }} /> {this.state.loading && <Text>{'Loading...'}</Text>} </ScrollView> ); }

y me deshice de ScrollView usando FlatList para representar todo lo que necesitaba, lo que eliminó la advertencia:

 render() { const getHeader = () => { return <Text>{'My Title'}</Text>; }; const getFooter = () => { if (this.state.loading) { return null; } return <Text>{'Loading...'}</Text>; }; return ( <FlatList data={this.state.myData} renderItem={({ item }) => { return <p>{item.name}</p>; }} ListHeaderComponent={getHeader} ListFooterComponent={getFooter} /> ); }
over 4 years ago · Santiago Trujillo Report

0

La mejor manera es deshabilitar esa advertencia porque, a veces Flatlist debe estar en ScrollView .

ACTUALIZAR RN V0.63 ARRIBA

YellowBox ahora se cambia y reemplaza con LogBox

FUNCIONAL

 import React, { useEffect } from 'react'; import { LogBox } from 'react-native'; useEffect(() => { LogBox.ignoreLogs(['VirtualizedLists should never be nested']); }, [])

BASADO EN CLASE

 import React from 'react'; import { LogBox } from 'react-native'; componentDidMount() { LogBox.ignoreLogs(['VirtualizedLists should never be nested']); }

ACTUALIZAR RN V0.63 ABAJO

FUNCIONAL

 import React, { useEffect } from 'react'; import { YellowBox } from 'react-native'; useEffect(() => { YellowBox.ignoreWarnings(['VirtualizedLists should never be nested']); }, [])

BASADO EN CLASE

 import React from 'react'; import { YellowBox } from 'react-native'; componentDidMount() { YellowBox.ignoreWarnings(['VirtualizedLists should never be nested']); }
over 4 years ago · Santiago Trujillo Report
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!