Skip to content

Prevent rendering all but the active view? #1002

Open
@rtlayzell

Description

@rtlayzell

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions