FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: crash on Android Tab-View #6466 by DickSmith · Pull Request #6467 · NativeScript/NativeScript · GitHub

19 changes: 13 additions & 6 deletions tns-core-modules/ui/tab-view/tab-view.android.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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;
}
}

Back | FazBrowse Home | New Git URL