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

189
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
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