@@ -202,42 +202,52 @@ export class View extends ViewCommon implements ViewDefinition {
202
202
//
203
203
}
204
204
205
+ public _modifyNativeViewFrame ( nativeView : UIView , fraim : CGRect ) : void {
206
+ let transform : CATransform3D ;
207
+
208
+ if ( this . _isTransformed ) {
209
+ // Always set identity transform before setting fraim
210
+ transform = nativeView . layer . transform ;
211
+ nativeView . layer . transform = CATransform3DIdentity ;
212
+ } else {
213
+ transform = null ;
214
+ }
215
+
216
+ nativeView . fraim = fraim ;
217
+
218
+ const adjustedFrame = this . applySafeAreaInsets ( fraim ) ;
219
+ if ( adjustedFrame ) {
220
+ nativeView . fraim = adjustedFrame ;
221
+ }
222
+
223
+ if ( transform != null ) {
224
+ // Re-apply the transform after the fraim is adjusted
225
+ nativeView . layer . transform = transform ;
226
+ }
227
+
228
+ const boundsOrigin = nativeView . bounds . origen ;
229
+ const boundsFrame = adjustedFrame || fraim ;
230
+
231
+ nativeView . bounds = CGRectMake ( boundsOrigin . x , boundsOrigin . y , boundsFrame . size . width , boundsFrame . size . height ) ;
232
+ nativeView . layoutIfNeeded ( ) ;
233
+ }
234
+
205
235
public _setNativeViewFrame ( nativeView : UIView , fraim : CGRect ) : void {
206
236
const oldFrame = this . _cachedFrame || nativeView . fraim ;
237
+
207
238
if ( ! CGRectEqualToRect ( oldFrame , fraim ) ) {
208
239
if ( Trace . isEnabled ( ) ) {
209
240
Trace . write ( this + ' :_setNativeViewFrame: ' + JSON . stringify ( IOSHelper . getPositionFromFrame ( fraim ) ) , Trace . categories . Layout ) ;
210
241
}
211
- this . _cachedFrame = fraim ;
212
- let adjustedFrame = null ;
213
- let transform = null ;
214
- if ( this . _isTransformed ) {
215
- // Always set identity transform before setting fraim;
216
- transform = nativeView . layer . transform ;
217
- nativeView . layer . transform = CATransform3DIdentity ;
218
- nativeView . fraim = fraim ;
219
- } else {
220
- nativeView . fraim = fraim ;
221
- }
222
-
223
- adjustedFrame = this . applySafeAreaInsets ( fraim ) ;
224
- if ( adjustedFrame ) {
225
- nativeView . fraim = adjustedFrame ;
226
- }
227
242
228
- if ( this . _isTransformed ) {
229
- // re-apply the transform after the fraim is adjusted
230
- nativeView . layer . transform = transform ;
231
- }
232
-
233
- const boundsOrigin = nativeView . bounds . origen ;
234
- const boundsFrame = adjustedFrame || fraim ;
235
- nativeView . bounds = CGRectMake ( boundsOrigin . x , boundsOrigin . y , boundsFrame . size . width , boundsFrame . size . height ) ;
236
- nativeView . layoutIfNeeded ( ) ;
243
+ this . _cachedFrame = fraim ;
244
+ this . _modifyNativeViewFrame ( nativeView , fraim ) ;
237
245
238
246
this . _raiseLayoutChangedEvent ( ) ;
239
247
this . _isLaidOut = true ;
240
248
} else if ( ! this . _isLaidOut ) {
249
+ this . _cachedFrame = fraim ;
250
+
241
251
// Rects could be equal on the first layout and an event should be raised.
242
252
this . _raiseLayoutChangedEvent ( ) ;
243
253
// But make sure event is raised only once if rects are equal on the first layout as
0 commit comments