Content-Length: 335242 | pFad | http://github.com/NativeScript/NativeScript/commit/050601232ac4f424e9d3ba6b711f3ada4afe253b

B8 fix(layout): prevent negative width/height values (#10616) · NativeScript/NativeScript@0506012 · GitHub
Skip to content

Commit 0506012

Browse files
authored
fix(layout): prevent negative width/height values (#10616)
1 parent 7b4cb84 commit 0506012

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

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

+8-3
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,14 @@ export class IOSHelper {
261261

262262
const left = layout.toDeviceIndependentPixels(position.left + insets.left);
263263
const top = layout.toDeviceIndependentPixels(position.top + insets.top);
264-
const width = layout.toDeviceIndependentPixels(position.right - position.left - insets.left - insets.right);
265-
const height = layout.toDeviceIndependentPixels(position.bottom - position.top - insets.top - insets.bottom);
266-
264+
let width = layout.toDeviceIndependentPixels(position.right - position.left - insets.left - insets.right);
265+
let height = layout.toDeviceIndependentPixels(position.bottom - position.top - insets.top - insets.bottom);
266+
if (width < 0) {
267+
width = 0;
268+
}
269+
if (height < 0) {
270+
height = 0;
271+
}
267272
return CGRectMake(left, top, width, height);
268273
}
269274

packages/core/ui/core/view/view-helper/view-helper-common.ts

+6
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ export class ViewHelper {
8282
default:
8383
childTop = top + effectiveMarginTop;
8484
childHeight = bottom - top - (effectiveMarginTop + effectiveMarginBottom);
85+
if (childHeight < 0) {
86+
childHeight = 0;
87+
}
8588
break;
8689
}
8790

@@ -112,6 +115,9 @@ export class ViewHelper {
112115
default:
113116
childLeft = left + effectiveMarginLeft;
114117
childWidth = right - left - (effectiveMarginLeft + effectiveMarginRight);
118+
if (childWidth < 0) {
119+
childWidth = 0;
120+
}
115121
break;
116122
}
117123

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/NativeScript/commit/050601232ac4f424e9d3ba6b711f3ada4afe253b

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy