mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +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) {
|
||||
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);
|
||||
} else {
|
||||
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 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);
|
||||
switch (dock) {
|
||||
case Dock.top:
|
||||
@ -135,11 +141,7 @@ export class DockLayout extends common.DockLayout {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!last) {
|
||||
View.layoutChild(this, child, childLeft, childTop, childLeft + childWidth, childTop + childHeight);
|
||||
} else {
|
||||
View.layoutChild(this, child, x, y, x + remainingWidth, y + remainingHeight);
|
||||
}
|
||||
View.layoutChild(this, child, childLeft, childTop, childLeft + childWidth, childTop + childHeight);
|
||||
});
|
||||
|
||||
DockLayout.restoreOriginalParams(this);
|
||||
|
Reference in New Issue
Block a user