Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions tns-core-modules/ui/tab-view/tab-view.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,17 @@ function initializeNativeClasses() {
}

finishUpdate(container: android.view.ViewGroup): void {
if (this.mCurTransaction != null) {
(<any>this.mCurTransaction).commitNowAllowingStateLoss();
this.mCurTransaction = null;
}
this._commitCurrentTransaction();
}

isViewFromObject(view: android.view.View, object: java.lang.Object): boolean {
return (<android.support.v4.app.Fragment>object).getView() === view;
}

saveState(): android.os.Parcelable {
// Commit the current transaction on save to prevent "No view found for id 0xa" exception on restore.
// Related to: https://github.com/NativeScript/NativeScript/issues/6466
this._commitCurrentTransaction();
return null;
}

Expand All @@ -221,8 +221,15 @@ function initializeNativeClasses() {
getItemId(position: number): number {
return position;
}
}

private _commitCurrentTransaction() {
if (this.mCurTransaction != null) {
this.mCurTransaction.commitNowAllowingStateLoss();
this.mCurTransaction = null;
}
}
}

PagerAdapter = FragmentPagerAdapter;
}

Expand Down Expand Up @@ -713,4 +720,4 @@ function tryCloneDrawable(value: android.graphics.drawable.Drawable, resources:
}

return value;
}
}