Closed ozexpert closed 7 years ago
I never implemented an orientation change event since I handn't personally had a need yet however to do it it's pretty easy. I believe in the ngOnInit
we will want to add a line of code similar to the non angular version of the slides such as https://github.com/TheOriginalJosh/nativescript-slides/blob/master/nativescript-slides.ts#L210
the same issue for me
i was able to fix this issue by placing:
`// handles application orientation change
app.on(app.orientationChangedEvent, (args: app.OrientationChangedEventData) => {
// event and page orientation didn't seem to alwasy be on the same page so
// setting it in the time out addresses this.
setTimeout(() => {
console.log('orientationChangedEvent');
this.pageWidth = platform.screen.mainScreen.widthDIPs;
this.pageHeight = platform.screen.mainScreen.heightDIPs;
// loop through slides and setup height and widith
this.slides.forEach((slide: SlideComponent) => {
AbsoluteLayout.setLeft(slide.layout, this.pageWidth);
slide.slideWidth = this.pageWidth;
slide.slideHeight = this.pageHeight;
slide.layout.eachLayoutChild((view: View) => {
if (view instanceof StackLayout) {
AbsoluteLayout.setLeft(view, this.pageWidth);
view.width = this.pageWidth;
}
});
});
if (this.currentSlide) {
this.positionSlides(this.currentSlide);
this.applySwipe(this.pageWidth);
}
}, 0);`
in the end of the ngOnInit, it kind of works for me, would you be able to review and include in your next release?
@dobjek Awesome! thank you, I really appreciate it. if you could please make PR for the repo and make sure you include yourself on the contributor's list.
I just published this in version 0.2.0
with
slides
changing from landscape <-> portrait mode layout seems not responsive.