fix tab-view, segmented-bar, action-bar, all ViewBases (#3340)

This commit is contained in:
Hristo Hristov
2016-12-21 12:02:02 +02:00
committed by GitHub
parent 2580dcf575
commit f5905f072d
22 changed files with 175 additions and 249 deletions

View File

@@ -12,7 +12,6 @@ export module knownCollections {
export abstract class SegmentedBarItemBase extends ViewBase implements SegmentedBarItemDefinition {
private _title: string = "";
public _parent: SegmentedBarBase;
get title(): string {
return this._title;
@@ -64,8 +63,8 @@ export abstract class SegmentedBarBase extends View implements SegmentedBarDefin
}
// TODO: Make _addView to keep its children so this method is not needed!
public _eachChildView(callback: (child: ViewBase) => boolean): void {
let items = this.items;
public eachChild(callback: (child: ViewBase) => boolean): void {
const items = this.items;
if (items) {
items.forEach((item, i) => {
callback(item);

View File

@@ -9,11 +9,12 @@ export * from "./segmented-bar-common";
export class SegmentedBarItem extends SegmentedBarItemBase {
public _update() {
if (this._parent) {
let tabIndex = this._parent.items.indexOf(this);
const parent = <SegmentedBar>this.parent;
if (parent) {
let tabIndex = parent.items.indexOf(this);
let title = this.title;
title = (title === null || title === undefined) ? "" : title;
this._parent.ios.setTitleForSegmentAtIndex(title, tabIndex);
parent.ios.setTitleForSegmentAtIndex(title, tabIndex);
}
}
}