8000 Correct animations by darklight365 · Pull Request #132 · NativeScript/angular · GitHub
[go: up one dir, main page]

Skip to content

Correct animations #132

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

Merged
merged 2 commits into from
May 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Correct animations
Allow Angular 17 animations to work correctly
  • Loading branch information
darklight365 authored May 1, 2024
commit 85ad57657b4b203356ac6a9c0b4fbe36c67250e0
29 changes: 13 additions & 16 deletions packages/angular/src/lib/animations/animations.module.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
import { NgModule, Injectable, Inject, NgZone, RendererFactory2, Optional, SkipSelf } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { AnimationBuilder } from '@angular/animations';
import { AnimationBuilder, ɵBrowserAnimationBuilder as BrowserAnimationBuilder } from '@angular/animations';

import { AnimationDriver, ɵAnimationStyleNormalizer as AnimationStyleNormalizer, ɵWebAnimationsStyleNormalizer as WebAnimationsStyleNormalizer, ɵAnimationEngine as AnimationEngine } from '@angular/animations/browser';
import { AnimationDriver, ɵAnimationRendererFactory as AnimationRendererFactory, ɵAnimationStyleNormalizer as AnimationStyleNormalizer, ɵWebAnimationsStyleNormalizer as WebAnimationsStyleNormalizer, ɵAnimationEngine as AnimationEngine } from '@angular/animations/browser';

// import { ɵAnimationRendererFactory as AnimationRendererFactory, ɵBrowserAnimationBuilder as BrowserAnimationBuilder } from '@angular/platform-browser/animations';

// import { NativeScriptModule } from "../nativescript.module";
// import { NativeScriptRendererFactory } from '../nativescript-renderer';
import { NativeScriptRendererFactory } from '../nativescript-renderer';
import { NativeScriptAnimationDriver } from './animation-driver';
import { throwIfAlreadyLoaded } from '../utils/general';
import { NativeScriptCommonModule } from '../nativescript-common.module';

@Injectable()
export class InjectableAnimationEngine extends AnimationEngine {
constructor(@Inject(DOCUMENT) doc: any, driver: AnimationDriver, normalizer: AnimationStyleNormalizer) {
super(doc.body, driver, normalizer);
super(doc, driver, normalizer);
}
}

export function instantiateSupportedAnimationDriver() {
return new NativeScriptAnimationDriver();
}

// export function instantiateRendererFactory(renderer: NativeScriptRendererFactory, engine: AnimationEngine, zone: NgZone) {
// return new AnimationRendererFactory(renderer, engine, zone);
// }
export function instantiateRendererFactory(renderer: NativeScriptRendererFactory, engine: AnimationEngine, zone: NgZone) {
return new AnimationRendererFactory(renderer, engine, zone);
}

export function instantiateDefaultStyleNormalizer() {
return new WebAnimationsStyleNormalizer();
Expand All @@ -38,17 +35,17 @@ export function instantiateDefaultStyleNormalizer() {
provide: AnimationDriver,
useFactory: instantiateSupportedAnimationDriver,
},
// { provide: AnimationBuilder, useClass: BrowserAnimationBuilder },
{ provide: AnimationBuilder, useClass: BrowserAnimationBuilder },
{
provide: AnimationStyleNormalizer,
useFactory: instantiateDefaultStyleNormalizer,
},
{ provide: AnimationEngine, useClass: InjectableAnimationEngine },
// {
// provide: RendererFactory2,
// useFactory: instantiateRendererFactory,
// deps: [NativeScriptRendererFactory, AnimationEngine, NgZone],
// },
{
provide: RendererFactory2,
useFactory: instantiateRendererFactory,
deps: [NativeScriptRendererFactory, AnimationEngine, NgZone],
},
],
})
export class NativeScriptAnimationsModule {
Expand Down
0