callstack / callstack/react-native-pager-view

Prevent rendering all but the active view?

Abierto
#1,002 2 comentarios 2 reacciones 0 asignados Ver en GitHub
question
Lenguaje dominante
TypeScript
Estrellas
3.4k
Forks
476
Merge medio
10 d 21 h
PR fusionados (30 d)
2

Descripción

Hi, first of all, thanks for the great work!🙂

I want to use your `PagerView` to create a sign-up/onboarding process with a number forms one after the other. It works well but I notice that it renders all of the offscreen views as well and rendering all those components is making my app sluggish. I tried setting `offscreenPageLimit` to `1` but it still renders all six of my pages.

Would it be possible to somehow render only the active page? As moving between pages is expected to be relatively infrequent when compared to other uses, it would be nice to optimize it in this way.

If not, do you have any recommendations for alternative components/libraries I could use to achieve this? I don't want to use the expo-router as the slide in animation is slow and lags.

**Edit:** It may not be entirely a rendering issue, as I noticed if I don't move between the pages, only the active page is rendered. But for some reason, performance degrades with the number pages and the content within them. The same performance issues weren't there in something like `react-native-swiper` (which I believe is built on top of a `ScrollView` 😅) and it's not the pages themselves as individually rendered they're performant.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

No se nombran archivos fuente ni pruebas. Empieza reproduciendo el caso de PagerView de seis páginas con offscreenPageLimit establecido en 1, incluida la navegación entre páginas, y compara el rendimiento con páginas renderizadas individualmente y con react-native-swiper. Se considerará terminado cuando haya un comportamiento de renderizado demostrado con una implementación definida o una recomendación documentada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
react-native, typescript
Área
mobile-dev, performance
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.