Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dfa208a

Browse files
authored
fix-next: apply ios safe area before transform (NativeScript#6443)
1 parent a58fc52 commit dfa208a

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

tns-core-modules/ui/core/view/view.ios.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,24 @@ export class View extends ViewCommon {
160160
}
161161
this._cachedFrame = frame;
162162
let adjustedFrame = null;
163+
let transform = null;
163164
if (this._hasTransfrom) {
164165
// Always set identity transform before setting frame;
165-
const transform = nativeView.transform;
166+
transform = nativeView.transform;
166167
nativeView.transform = CGAffineTransformIdentity;
167168
nativeView.frame = frame;
168-
nativeView.transform = transform;
169169
} else {
170170
nativeView.frame = frame;
171-
// apply safe area insets only if no transform is in place
172-
adjustedFrame = this.applySafeAreaInsets(frame);
173-
if (adjustedFrame) {
174-
nativeView.frame = adjustedFrame;
175-
}
171+
}
172+
173+
adjustedFrame = this.applySafeAreaInsets(frame);
174+
if (adjustedFrame) {
175+
nativeView.frame = adjustedFrame;
176+
}
177+
178+
if (this._hasTransfrom) {
179+
// re-apply the transform after the frame is adjusted
180+
nativeView.transform = transform;
176181
}
177182

178183
const boundsOrigin = nativeView.bounds.origin;

0 commit comments

Comments
 (0)