From a44c9f9aa6cb4a76195ccdaa7ebb007baf5e324c Mon Sep 17 00:00:00 2001 From: Nedyalko Nikolov Date: Wed, 25 Nov 2015 08:51:36 +0200 Subject: [PATCH] Added some checks for binding infrastructure. --- ui/core/bindable.ts | 18 +++++++++--------- ui/list-view/list-view.ios.ts | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ui/core/bindable.ts b/ui/core/bindable.ts index da2c31fa2..4a2f428c8 100644 --- a/ui/core/bindable.ts +++ b/ui/core/bindable.ts @@ -258,9 +258,9 @@ export class Binding { } result.push({ instance: currentObject, property: objProp }); if (!currentObjectChanged) { - currentObject = currentObject[propsArray[i]]; - currentObjectChanged = false; + currentObject = currentObject ? currentObject[propsArray[i]] : null; } + currentObjectChanged = false; } return result; } @@ -273,7 +273,7 @@ export class Binding { for (i = 0; i < objectsAndPropertiesLength; i++) { var prop = objectsAndProperties[i].property; var currentObject = objectsAndProperties[i].instance; - if (!this.propertyChangeListeners[prop] && currentObject instanceof observable.Observable) { + if (currentObject && !this.propertyChangeListeners[prop] && currentObject instanceof observable.Observable) { weakEvents.addWeakEventListener( currentObject, observable.Observable.propertyChangeEvent, @@ -563,14 +563,14 @@ export class Binding { if (objectsAndProperties.length > 0) { var resolvedObj = objectsAndProperties[objectsAndProperties.length - 1].instance; var prop = objectsAndProperties[objectsAndProperties.length - 1].property; - return { - instance: new WeakRef(resolvedObj), - property: prop + if (resolvedObj) { + return { + instance: new WeakRef(resolvedObj), + property: prop + } } } - else { - return null; - } + return null; } private updateOptions(options: { instance: WeakRef; property: any }, value: any) { diff --git a/ui/list-view/list-view.ios.ts b/ui/list-view/list-view.ios.ts index a6de7aebf..7477d40f1 100644 --- a/ui/list-view/list-view.ios.ts +++ b/ui/list-view/list-view.ios.ts @@ -206,6 +206,7 @@ export class ListView extends common.ListView { this._ios.registerClassForCellReuseIdentifier(ListViewCell.class(), CELLIDENTIFIER); this._ios.autoresizingMask = UIViewAutoresizing.UIViewAutoresizingNone; this._ios.estimatedRowHeight = DEFAULT_HEIGHT; + this._ios.rowHeight = UITableViewAutomaticDimension; this._ios.dataSource = this._dataSource = DataSource.initWithOwner(new WeakRef(this)); this._delegate = UITableViewDelegateImpl.initWithOwner(new WeakRef(this)); this._heights = new Array();