File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed
projects/igniteui-angular/src/lib/directives/button Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change 88 Output ,
99 booleanAttribute ,
1010 inject ,
11- afterRenderEffect ,
11+ AfterViewInit ,
1212} from '@angular/core' ;
1313import { PlatformUtil } from '../../core/utils' ;
1414
@@ -20,8 +20,9 @@ export const IgxBaseButtonType = {
2020
2121
2222@Directive ( )
23- export abstract class IgxButtonBaseDirective {
23+ export abstract class IgxButtonBaseDirective implements AfterViewInit {
2424 private _platformUtil = inject ( PlatformUtil ) ;
25+ private _viewInit = false ;
2526
2627 /**
2728 * Emitted when the button is clicked.
@@ -101,15 +102,16 @@ export abstract class IgxButtonBaseDirective {
101102 // In SSR there is no paint, so there’s no visual rendering or transitions to suppress.
102103 // Fix style flickering https://github.com/IgniteUI/igniteui-angular/issues/14759
103104 if ( this . _platformUtil . isBrowser ) {
104- afterRenderEffect ( {
105- write : ( ) => {
106- this . element . nativeElement . style . setProperty ( '--_init-transition' , '0s' ) ;
107- } ,
108- read : ( ) => {
109- requestAnimationFrame ( ( ) => {
110- this . element . nativeElement . style . removeProperty ( '--_init-transition' ) ;
111- } ) ;
112- }
105+ this . element . nativeElement . style . setProperty ( '--_init-transition' , '0s' ) ;
106+ }
107+ }
108+
109+ public ngAfterViewInit ( ) : void {
110+ if ( this . _platformUtil . isBrowser && ! this . _viewInit ) {
111+ this . _viewInit = true ;
112+
113+ requestAnimationFrame ( ( ) => {
114+ this . element . nativeElement . style . removeProperty ( '--_init-transition' ) ;
113115 } ) ;
114116 }
115117 }
You can’t perform that action at this time.
0 commit comments