Skip to content

Commit 46d9827

Browse files
authored
chore(ios): removed forced background update during safe area inset calculation (NativeScript#10767)
1 parent 0dc8b2b commit 46d9827

File tree

3 files changed

+2
-17
lines changed

3 files changed

+2
-17
lines changed

apps/automated/src/ui/view/view-tests.ios.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,11 @@ export function testBackgroundInternalChangedOnceOnResize() {
7777

7878
TKUnit.assertEqual(trackCount(), 1, 'Expected background to be re-applied at most once when the view is laid-out on 0 0 200 200.');
7979

80-
// Ignore safe area as it may result in re-calculating view frame, thus trigger a size change regardless
81-
layout.iosIgnoreSafeArea = true;
82-
8380
layout.requestLayout();
8481
layout.layout(50, 50, 250, 250);
8582

8683
TKUnit.assertEqual(trackCount(), 0, 'Expected background to NOT change when view is laid-out from 0 0 200 200 to 50 50 250 250.');
8784

88-
layout.iosIgnoreSafeArea = false;
89-
9085
layout.requestLayout();
9186
layout.layout(0, 0, 250, 250);
9287

packages/core/ui/core/view/index.ios.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,29 +106,20 @@ export class View extends ViewCommon implements ViewDefinition {
106106

107107
@profile
108108
public layout(left: number, top: number, right: number, bottom: number, setFrame = true): void {
109-
const result = this._setCurrentLayoutBounds(left, top, right, bottom);
110-
let { sizeChanged } = result;
109+
const { boundsChanged, sizeChanged } = this._setCurrentLayoutBounds(left, top, right, bottom);
111110

112111
if (setFrame) {
113112
this.layoutNativeView(left, top, right, bottom);
114113
}
115114

116-
const needsLayout = result.boundsChanged || (this._privateFlags & PFLAG_LAYOUT_REQUIRED) === PFLAG_LAYOUT_REQUIRED;
115+
const needsLayout = boundsChanged || (this._privateFlags & PFLAG_LAYOUT_REQUIRED) === PFLAG_LAYOUT_REQUIRED;
117116
if (needsLayout) {
118117
let position: Position;
119118

120119
if (this.nativeViewProtected && SDK_VERSION > 10) {
121120
// on iOS 11+ it is possible to have a changed layout frame due to safe area insets
122121
// get the frame and adjust the position, so that onLayout works correctly
123122
position = IOSHelper.getPositionFromFrame(this.nativeViewProtected.frame);
124-
125-
if (!sizeChanged) {
126-
// If frame has actually changed, there is the need to update view background and border styles as they depend on native view bounds
127-
// To trigger the needed visual update, mark size as changed
128-
if (position.left !== left || position.top !== top || position.right !== right || position.bottom !== bottom) {
129-
sizeChanged = true;
130-
}
131-
}
132123
} else {
133124
position = { left, top, right, bottom };
134125
}

packages/core/ui/styling/background.ios.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { ImageSource } from '../../image-source';
99
import type { CSSValue } from '../../css-value/reworkcss-value';
1010
import { parse as cssParse } from '../../css-value/reworkcss-value.js';
1111
import { BoxShadow } from './box-shadow';
12-
import { Length } from './style-properties';
1312
import { BackgroundClearFlags } from './background-common';
1413
import { ClipPathFunction } from './clip-path-function';
1514

0 commit comments

Comments
 (0)