GithubHelp home page GithubHelp logo

Comments (5)

JoshDSommer avatar JoshDSommer commented on June 2, 2024

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

from nativescript-ngx-slides.

dobjek avatar dobjek commented on June 2, 2024

the same issue for me

from nativescript-ngx-slides.

dobjek avatar dobjek commented on June 2, 2024

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?

from nativescript-ngx-slides.

JoshDSommer avatar JoshDSommer commented on June 2, 2024

@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.

from nativescript-ngx-slides.

JoshDSommer avatar JoshDSommer commented on June 2, 2024

I just published this in version 0.2.0

from nativescript-ngx-slides.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.