Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions apps/automated/src/ui/view/view-tests.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,11 @@ export function testBackgroundInternalChangedOnceOnResize() {

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

// Ignore safe area as it may result in re-calculating view frame, thus trigger a size change regardless
layout.iosIgnoreSafeArea = true;

layout.requestLayout();
layout.layout(50, 50, 250, 250);

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

layout.iosIgnoreSafeArea = false;

layout.requestLayout();
layout.layout(0, 0, 250, 250);

Expand Down
13 changes: 2 additions & 11 deletions packages/core/ui/core/view/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,29 +106,20 @@ export class View extends ViewCommon implements ViewDefinition {

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

if (setFrame) {
this.layoutNativeView(left, top, right, bottom);
}

const needsLayout = result.boundsChanged || (this._privateFlags & PFLAG_LAYOUT_REQUIRED) === PFLAG_LAYOUT_REQUIRED;
const needsLayout = boundsChanged || (this._privateFlags & PFLAG_LAYOUT_REQUIRED) === PFLAG_LAYOUT_REQUIRED;
if (needsLayout) {
let position: Position;

if (this.nativeViewProtected && SDK_VERSION > 10) {
// on iOS 11+ it is possible to have a changed layout frame due to safe area insets
// get the frame and adjust the position, so that onLayout works correctly
position = IOSHelper.getPositionFromFrame(this.nativeViewProtected.frame);

if (!sizeChanged) {
// If frame has actually changed, there is the need to update view background and border styles as they depend on native view bounds
// To trigger the needed visual update, mark size as changed
if (position.left !== left || position.top !== top || position.right !== right || position.bottom !== bottom) {
sizeChanged = true;
}
}
} else {
position = { left, top, right, bottom };
}
Expand Down
1 change: 0 additions & 1 deletion packages/core/ui/styling/background.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { ImageSource } from '../../image-source';
import type { CSSValue } from '../../css-value/reworkcss-value';
import { parse as cssParse } from '../../css-value/reworkcss-value.js';
import { BoxShadow } from './box-shadow';
import { Length } from './style-properties';
import { BackgroundClearFlags } from './background-common';
import { ClipPathFunction } from './clip-path-function';

Expand Down