| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 54125e1 commit e1bd329
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1521,6 +1521,12 @@ export class View extends ViewCommon { | |||
| 1521 | 1521 | ||
| 1522 | 1522 | if (value && typeof value === 'object' && (value as any).unit === '%') { | |
| 1523 | 1523 | const pct = (value as any).value; | |
| 1524 | + // A parent that lays out its children itself resolves the percentage. | ||
| 1525 | + if ((this.parent as any)?._setChildPercentSize?.(this, true, pct)) { | ||
| 1526 | + this._percentWidth = null; | ||
| 1527 | + this.nativeViewProtected.Width = NaN; | ||
| 1528 | + return; | ||
| 1529 | + } | ||
| 1524 | 1530 | this._percentWidth = pct; | |
| 1525 | 1531 | this._ensureSizeWatch(); // re-apply percent when the parent resizes | |
| 1526 | 1532 | this.nativeViewProtected.Width = NaN; | |
@@ -1543,6 +1549,7 @@ export class View extends ViewCommon { | |||
| 1543 | 1549 | } | |
| 1544 | 1550 | ||
| 1545 | 1551 | this._percentWidth = null; | |
| 1552 | + (this.parent as any)?._setChildPercentSize?.(this, true, null); | ||
| 1546 | 1553 | // Clear any previously set flex-basis so the C++ widget falls back to DesiredSize. | |
| 1547 | 1554 | try { | |
| 1548 | 1555 | (NativeScript as any).Widgets.FlexboxLayout.SetFlexBasisPercent( | |
@@ -1560,6 +1567,11 @@ export class View extends ViewCommon { | |||
| 1560 | 1567 | ||
| 1561 | 1568 | if (value && typeof value === 'object' && (value as any).unit === '%') { | |
| 1562 | 1569 | const pct = (value as any).value; | |
| 1570 | + if ((this.parent as any)?._setChildPercentSize?.(this, false, pct)) { | ||
| 1571 | + this._percentHeight = null; | ||
| 1572 | + this.nativeViewProtected.Height = NaN; | ||
| 1573 | + return; | ||
| 1574 | + } | ||
| 1563 | 1575 | this._percentHeight = pct; | |
| 1564 | 1576 | this._ensureSizeWatch(); // re-apply percent when the parent resizes | |
| 1565 | 1577 | this.nativeViewProtected.Height = NaN; | |
@@ -1577,6 +1589,7 @@ export class View extends ViewCommon { | |||
| 1577 | 1589 | } | |
| 1578 | 1590 | ||
| 1579 | 1591 | this._percentHeight = null; | |
| 1592 | + (this.parent as any)?._setChildPercentSize?.(this, false, null); | ||
| 1580 | 1593 | this.nativeViewProtected.Height = toXamlLength(value); | |
| 1581 | 1594 | } | |
| 1582 | 1595 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments