mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Fix: bugs caught with tests
This commit is contained in:
@ -271,7 +271,7 @@ export class View extends viewCommon.View {
|
|||||||
if (superview && this._nativeView) {
|
if (superview && this._nativeView) {
|
||||||
var types = require("utils/types");
|
var types = require("utils/types");
|
||||||
|
|
||||||
if (types.isNullOrUndefined(atIndex) || atIndex >= this._nativeView.subviews.count) {
|
if (types.isNullOrUndefined(atIndex) || atIndex >= superview.subviews.count) {
|
||||||
superview.addSubview(this._nativeView);
|
superview.addSubview(this._nativeView);
|
||||||
} else {
|
} else {
|
||||||
superview.insertSubviewAtIndex(this._nativeView, atIndex);
|
superview.insertSubviewAtIndex(this._nativeView, atIndex);
|
||||||
|
@ -100,7 +100,13 @@ export class DockLayout extends common.DockLayout {
|
|||||||
|
|
||||||
let childWidth = child.getMeasuredWidth() + (lp.leftMargin + lp.rightMargin) * density;
|
let childWidth = child.getMeasuredWidth() + (lp.leftMargin + lp.rightMargin) * density;
|
||||||
let childHeight = child.getMeasuredHeight() + (lp.topMargin + lp.bottomMargin) * density;
|
let childHeight = child.getMeasuredHeight() + (lp.topMargin + lp.bottomMargin) * density;
|
||||||
|
|
||||||
|
if (last && this.stretchLastChild) {
|
||||||
|
// Last child with stretch - give it all the space and return;
|
||||||
|
View.layoutChild(this, child, x, y, x + remainingWidth, y + remainingHeight);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let dock = DockLayout.getDock(child);
|
let dock = DockLayout.getDock(child);
|
||||||
switch (dock) {
|
switch (dock) {
|
||||||
case Dock.top:
|
case Dock.top:
|
||||||
@ -135,11 +141,7 @@ export class DockLayout extends common.DockLayout {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!last) {
|
View.layoutChild(this, child, childLeft, childTop, childLeft + childWidth, childTop + childHeight);
|
||||||
View.layoutChild(this, child, childLeft, childTop, childLeft + childWidth, childTop + childHeight);
|
|
||||||
} else {
|
|
||||||
View.layoutChild(this, child, x, y, x + remainingWidth, y + remainingHeight);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
DockLayout.restoreOriginalParams(this);
|
DockLayout.restoreOriginalParams(this);
|
||||||
|
Reference in New Issue
Block a user