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: weird issue when changing orientation #167

Open
felixkrautschuk opened this issue Mar 6, 2020 · 3 comments
Open

Android: weird issue when changing orientation #167

felixkrautschuk opened this issue Mar 6, 2020 · 3 comments

Comments

@felixkrautschuk
Copy link

felixkrautschuk commented Mar 6, 2020

Which platform(s) does your issue occur on?

  • Android
  • tested on Android 4, Android 7 and Android 10 (devices and emulators)

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.4.1
  • Cross-platform modules: 6.4.2
  • Runtime(s): tns-android 6.4.1
  • Plugin(s): nativescript-pager 12.0.0.alpha.8

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

When changing the orientation from portrait to landscape and then back to portrait, the user sees 95% of the next page.... just have a look at the GIF:

pager_android_orienation_issue

This issue does not occur if the user has selected the first page in the pager. But as soon as he goes forward to the second page, then you can see this side effect.

pager_android_orienation_issue2

Is there any code involved?

NSPagerIssueOrientationAndroid.zip

It is also reproducable on the demo app of this repo.

@felixkrautschuk
Copy link
Author

temporary workaround:

app.on(app.orientationChangedEvent, function(args) {
    setTimeout(function() {
        if(pager.selectedIndex > 0) {
            let temp = pager.selectedIndex;
            pager.scrollToIndexAnimated(temp-1, true);
            pager.scrollToIndexAnimated(temp, true);
         }
     }, 300);
});

but I hope there will be an official fix for this issue, because the workaround still has some optical side effects

@triniwiz
Copy link
Owner

Try forcing a layout e.g requestLayout

@felixkrautschuk
Copy link
Author

@triniwiz I already tried
pager.requestLayout(); and

pager.eachChild(function (view) {
    view.requestLayout();
});

but unfortunately that does not help

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

No branches or pull requests

2 participants