@@ -37,7 +37,8 @@ export class View extends ViewCommon implements ViewDefinition {
37
37
*/
38
38
private _modalAnimatedOptions : Array < boolean > ;
39
39
private _isLaidOut = false ;
40
- private _hasTransfrom = false ;
40
+ private _hasTransform = false ;
41
+ private _hasPendingTransform = false ;
41
42
private _privateFlags : number = PFLAG_LAYOUT_REQUIRED | PFLAG_FORCE_LAYOUT ;
42
43
private _cachedFrame : CGRect ;
43
44
private _suspendCATransaction = false ;
@@ -63,6 +64,15 @@ export class View extends ViewCommon implements ViewDefinition {
63
64
this . once ( View . loadedEvent , ( ) => setupAccessibleView ( this ) ) ;
64
65
}
65
66
67
+ disposeNativeView ( ) {
68
+ super . disposeNativeView ( ) ;
69
+
70
+ this . _cachedFrame = null ;
71
+ this . _isLaidOut = false ;
72
+ this . _hasTransform = false ;
73
+ this . _hasPendingTransform = false ;
74
+ }
75
+
66
76
public requestLayout ( ) : void {
67
77
super . requestLayout ( ) ;
68
78
this . _privateFlags |= PFLAG_FORCE_LAYOUT ;
@@ -119,6 +129,10 @@ export class View extends ViewCommon implements ViewDefinition {
119
129
}
120
130
121
131
this . updateBackground ( sizeChanged ) ;
132
+ if ( this . _hasPendingTransform ) {
133
+ this . updateNativeTransform ( ) ;
134
+ this . _hasPendingTransform = false ;
135
+ }
122
136
this . _privateFlags &= ~ PFLAG_FORCE_LAYOUT ;
123
137
}
124
138
@@ -175,7 +189,7 @@ export class View extends ViewCommon implements ViewDefinition {
175
189
this . _cachedFrame = frame ;
176
190
let adjustedFrame = null ;
177
191
let transform = null ;
178
- if ( this . _hasTransfrom ) {
192
+ if ( this . _hasTransform ) {
179
193
// Always set identity transform before setting frame;
180
194
transform = nativeView . layer . transform ;
181
195
nativeView . layer . transform = CATransform3DIdentity ;
@@ -189,7 +203,7 @@ export class View extends ViewCommon implements ViewDefinition {
189
203
nativeView . frame = adjustedFrame ;
190
204
}
191
205
192
- if ( this . _hasTransfrom ) {
206
+ if ( this . _hasTransform ) {
193
207
// re-apply the transform after the frame is adjusted
194
208
nativeView . layer . transform = transform ;
195
209
}
@@ -363,6 +377,11 @@ export class View extends ViewCommon implements ViewDefinition {
363
377
}
364
378
365
379
public updateNativeTransform ( ) {
380
+ if ( ! this . isLayoutValid ) {
381
+ this . _hasPendingTransform = true ;
382
+ return ;
383
+ }
384
+
366
385
const scaleX = this . scaleX || 1e-6 ;
367
386
const scaleY = this . scaleY || 1e-6 ;
368
387
const perspective = this . perspective || 300 ;
@@ -378,12 +397,12 @@ export class View extends ViewCommon implements ViewDefinition {
378
397
transform = iOSNativeHelper . applyRotateTransform ( transform , this . rotateX , this . rotateY , this . rotate ) ;
379
398
transform = CATransform3DScale ( transform , scaleX , scaleY , 1 ) ;
380
399
if ( ! CATransform3DEqualToTransform ( this . nativeViewProtected . layer . transform , transform ) ) {
381
- const updateSuspended = this . _isPresentationLayerUpdateSuspeneded ( ) ;
400
+ const updateSuspended = this . _isPresentationLayerUpdateSuspended ( ) ;
382
401
if ( ! updateSuspended ) {
383
402
CATransaction . begin ( ) ;
384
403
}
385
404
this . nativeViewProtected . layer . transform = transform ;
386
- this . _hasTransfrom = this . nativeViewProtected && ! CATransform3DEqualToTransform ( this . nativeViewProtected . transform3D , CATransform3DIdentity ) ;
405
+ this . _hasTransform = this . nativeViewProtected && ! CATransform3DEqualToTransform ( this . nativeViewProtected . transform3D , CATransform3DIdentity ) ;
387
406
if ( ! updateSuspended ) {
388
407
CATransaction . commit ( ) ;
389
408
}
@@ -409,7 +428,7 @@ export class View extends ViewCommon implements ViewDefinition {
409
428
this . _suspendCATransaction = false;
410
429
}
411
430
412
- public _isPresentationLayerUpdateSuspeneded ( ) : boolean {
431
+ public _isPresentationLayerUpdateSuspended ( ) : boolean {
413
432
return this . _suspendCATransaction || this . _suspendNativeUpdatesCount > 0 ;
414
433
}
415
434
@@ -689,7 +708,7 @@ export class View extends ViewCommon implements ViewDefinition {
689
708
}
690
709
[ opacityProperty . setNative ] ( value : number ) {
691
710
const nativeView = this . nativeViewProtected ;
692
- const updateSuspended = this . _isPresentationLayerUpdateSuspeneded ( ) ;
711
+ const updateSuspended = this . _isPresentationLayerUpdateSuspended ( ) ;
693
712
if ( ! updateSuspended ) {
694
713
CATransaction . begin ( ) ;
695
714
}
@@ -845,7 +864,7 @@ export class View extends ViewCommon implements ViewDefinition {
845
864
}
846
865
847
866
_redrawNativeBackground ( value : UIColor | Background ) : void {
848
- const updateSuspended = this . _isPresentationLayerUpdateSuspeneded ( ) ;
867
+ const updateSuspended = this . _isPresentationLayerUpdateSuspended ( ) ;
849
868
if ( ! updateSuspended ) {
850
869
CATransaction . begin ( ) ;
851
870
}
0 commit comments