mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Merge pull request #258 from NativeScript/feature/no-tab-content-bug
TabView - content disapears after minimize
This commit is contained in:
@ -233,6 +233,7 @@ export class TabView extends common.TabView {
|
||||
trace.write("TabView._onVisibilityChanged:" + this.android + " isShown():" + this.android.isShown(), common.traceCategory);
|
||||
|
||||
if (this.isLoaded && this.android && this.android.isShown()) {
|
||||
this._setAdapterIfNeeded();
|
||||
this._addTabsIfNeeded();
|
||||
this._setNativeSelectedIndex(this.selectedIndex);
|
||||
}
|
||||
@ -275,9 +276,8 @@ export class TabView extends common.TabView {
|
||||
if (this.android && this.android.isShown()) {
|
||||
// Cover the case when pageCacheOnNavigate is enabled - set adapter in loaded as the TabView is already
|
||||
// attached and _onItemsPropertyChangedSetNativeValue will not be called
|
||||
if (!this._pagerAdapter && this.items) {
|
||||
this._setAdapter(this.items);
|
||||
}
|
||||
this._setAdapterIfNeeded();
|
||||
|
||||
this._addTabsIfNeeded();
|
||||
this._setNativeSelectedIndex(this.selectedIndex);
|
||||
}
|
||||
@ -326,6 +326,12 @@ export class TabView extends common.TabView {
|
||||
this._listenersSuspended = false;
|
||||
}
|
||||
|
||||
private _setAdapterIfNeeded() {
|
||||
if (!this._pagerAdapter && this.items && this.items.length > 0) {
|
||||
this._setAdapter(this.items);
|
||||
}
|
||||
}
|
||||
|
||||
private _setAdapter(items) {
|
||||
this._pagerAdapter = new PagerAdapterClass(this, items);
|
||||
this._android.setAdapter(this._pagerAdapter);
|
||||
|
Reference in New Issue
Block a user