mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 01:43:14 +08:00
chore(ios): removed forced background update during safe area inset calculation (#10767)
This commit is contained in:

committed by
GitHub

parent
0dc8b2ba2a
commit
46d9827960
@ -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);
|
||||
|
||||
|
@ -106,14 +106,13 @@ 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;
|
||||
|
||||
@ -121,14 +120,6 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
// 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 };
|
||||
}
|
||||
|
@ -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';
|
||||
|
||||
|
Reference in New Issue
Block a user