callstack / callstack/react-native-pager-view

Prevent rendering all but the active view?

オープン
#1,002 コメント 2 件 リアクション 2 件 担当者 0 名 GitHub で見る
question
主要言語
TypeScript
スター
3.4k
フォーク
476
平均マージ
10日 21時間
マージ済み PR(30日)
2

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

ソースファイルやテストは指定されていません。まず、offscreenPageLimit を 1 に設定した 6 ページの PagerView のケースを、ページ間のナビゲーションを含めて再現し、個別にレンダリングしたページおよび react-native-swiper とパフォーマンスを比較してください。定義された実装または文書化された推奨事項とともに、レンダリング動作が実証されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
react-native, typescript
領域
mobile-dev, performance
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。