JoshDSommer / nativescript-ngx-slides

A NativeScript + Angular module for to add a slides component to your mobile app
Other
45 stars 34 forks source link

Error: Animation cancelled after host component destroy #68

Open wanpeng2008 opened 6 years ago

wanpeng2008 commented 6 years ago

I implement an auto running slider using setInterval()

    ngAfterViewInit(): void {
        this.interval = setInterval(()=>{
            this.topSliderComponent.nextSlide().then();
        }, 5000);

    }
    ngOnDestroy(): void {
        clearInterval(this.interval);
    }

When i route to other pages, "Animation cancelled" errors are thrown again and again.

CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:1686:28: ERROR Error: Uncaught (in promise): Error: Animation cancelled.
_rejectAnimationFinishedPromise@file:///app/tns_modules/tns-core-modules/ui/animation/animation-common.js:100:31 [<root>]
animationFinishedCallback@file:///app/tns_modules/tns-core-modules/ui/animation/animation.js:148:57 [<root>]
animationDidStopFinished@file:///app/tns_modules/tns-core-modules/ui/animation/animation.js:70:35 [<root>]
UIApplicationMain@[native code] [<root>]
start@file:///app/tns_modules/tns-core-modules/application/application.js:264:26 [<root>]
run@file:///app/tns_modules/tns-core-modules/application/application.js:284:10 [<root>]
bootstrapNativeScriptApp@file:///app/tns_modules/nativescript-angular/platform-common.js:157:26 [<root>]
bootstrapApp@file:///app/tns_modules/nativescript-angular/platform-common.js:91:38 [<root>]
bootstrapModule@file:///app/tns_modules/nativescript-angular/platform-common.js:80:26 [<root>]
anonymous@file:///app/main.js

What shall i do to eliminate this error?

JoshDSommer commented 6 years ago

I think this can be fixed by going through and updating all the animation promises to have a catch event.

animation.then(_ => {}, (err) => {});

I'll try to get to it here soon, but if you want to open a PR please feel free. Thanks

alqabali commented 5 years ago

any fix for that issue? @TheOriginalJosh