Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android pager content has different loading behaviour than iOS #30

Open
CatchABus opened this issue Feb 8, 2023 · 3 comments
Open

Android pager content has different loading behaviour than iOS #30

CatchABus opened this issue Feb 8, 2023 · 3 comments

Comments

@CatchABus
Copy link
Contributor

CatchABus commented Feb 8, 2023

In android, when you navigate to a page with a nested pager, its items will all render at the same time even though the rest of pager items aren't visible.
Pager has different behaviour in iOS however and loads pager items when user actually navigates to them for first time. It seems UICollectionView items are actually lazy-loaded.

I think iOS approach is the best as it doesn't stress UI on pager rendering.
@farfromrefug Do you think android fragments could solve this?

@farfromrefug
Copy link
Member

@CatchABus the issue is a cache size issue. On android you can change it with pageCount property. By default it is set to 0. Need to check what it means.
I will also in the weeks to come rename that property to cacheSize or something like it.
https://developer.android.com/reference/androidx/viewpager2/widget/ViewPager2#setOffscreenPageLimit(int)

@CatchABus
Copy link
Contributor Author

@CatchABus the issue is a cache size issue. On android you can change it with pageCount property. By default it is set to 0. Need to check what it means. I will also in the weeks to come rename that property to cacheSize or something like it. https://developer.android.com/reference/androidx/viewpager2/widget/ViewPager2#setOffscreenPageLimit(int)

Even though default is supposed to be -1 for pagesCount and native, I see plugin sets it to 3 on initNativeView: https://github.com/nativescript-community/ui-pager/blob/master/src/ui-pager/index.android.ts#L107

@farfromrefug
Copy link
Member

@CatchABus indeed it was the default when I took over the plugin. not sure but I think 3 means one left, current and one right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants