mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix tab-view, segmented-bar, action-bar, all ViewBases (#3340)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user