callstack / callstack/react-native-pager-view

Prevent rendering all but the active view?

Aperta
#1,002 2 commenti 2 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
TypeScript
Stelle
3.4k
Fork
476
Merge medio
10g 21h
PR unite (30g)
2

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Non vengono indicati file sorgente o test. Inizia riproducendo il caso PagerView di sei pagine con offscreenPageLimit impostato su 1, inclusa la navigazione tra le pagine, e confronta le prestazioni con pagine renderizzate singolarmente e con react-native-swiper. Il lavoro sarà considerato completato quando sarà disponibile un comportamento di rendering dimostrato con un’implementazione definita o una raccomandazione documentata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
react-native, typescript
Ambito
mobile-dev, performance
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.