fix: register layout child for nested custom components (#7230)

This commit is contained in:
Morten Sjøgren
2019-05-31 13:16:54 +02:00
committed by Manol Donev
parent a345a14a8b
commit 888fc5740f
3 changed files with 8 additions and 4 deletions

View File

@ -5,7 +5,7 @@ export * from "../layout-base";
function validateArgs(element: View): View { function validateArgs(element: View): View {
if (!element) { if (!element) {
throw new Error("element cannot be null or undefinied."); throw new Error("element cannot be null or undefined.");
} }
return element; return element;
} }
@ -291,7 +291,7 @@ export class GridLayoutBase extends LayoutBase implements GridLayoutDefinition {
} }
protected invalidate(): void { protected invalidate(): void {
// handled natively in android and overriden in ios. // handled natively in android and overridden in ios.
} }
set rows(value: string) { set rows(value: string) {

View File

@ -136,6 +136,10 @@ export class GridLayout extends GridLayoutBase {
this.eachLayoutChild((child, last) => { this.eachLayoutChild((child, last) => {
let measureSpecs = this.map.get(child); let measureSpecs = this.map.get(child);
if (!measureSpecs) {
return;
}
this.updateMeasureSpecs(child, measureSpecs); this.updateMeasureSpecs(child, measureSpecs);
this.helper.addMeasureSpec(measureSpecs); this.helper.addMeasureSpec(measureSpecs);
}); });

View File

@ -131,12 +131,12 @@ export class ProxyViewContainer extends LayoutBase implements ProxyViewContainer
const oldLayout = <LayoutBase>oldParent; const oldLayout = <LayoutBase>oldParent;
if (addingToParent && newLayout instanceof LayoutBase) { if (addingToParent && newLayout instanceof LayoutBase) {
this.eachChildView((child) => { this.eachLayoutChild((child) => {
newLayout._registerLayoutChild(child); newLayout._registerLayoutChild(child);
return true; return true;
}); });
} else if (oldLayout instanceof LayoutBase) { } else if (oldLayout instanceof LayoutBase) {
this.eachChildView((child) => { this.eachLayoutChild((child) => {
oldLayout._unregisterLayoutChild(child); oldLayout._unregisterLayoutChild(child);
return true; return true;
}); });