Merge pull request #1368 from NativeScript/feature/grid-separator

Accept whitespace separators in grid rows and cols properties
This commit is contained in:
Alexander Vakrilov
2016-01-14 10:26:15 +02:00
2 changed files with 25 additions and 5 deletions

View File

@@ -313,16 +313,18 @@ export class GridLayout extends layouts.LayoutBase implements definition.GridLay
private static parseItemSpecs(value: string): Array<ItemSpec> {
var result = new Array<ItemSpec>();
var arr = value.split(",");
var arr = value.split(/[\s,]+/);
for (var i = 0; i < arr.length; i++) {
result.push(GridLayout.convertGridLength(arr[i].trim()));
let str = arr[i].trim();
if (str.length > 0) {
result.push(GridLayout.convertGridLength(arr[i].trim()));
}
}
return result;
}
private static convertGridLength(value: string): ItemSpec {
if (value === "auto") {
return <ItemSpec>new definition.ItemSpec(1, definition.GridUnitType.auto);
}