Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 2 additions & 15 deletions tns-core-modules/ui/frame/frame.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,8 @@ export class Frame extends FrameBase {

const manager: android.support.v4.app.FragmentManager = this._getFragmentManager();
const transaction = manager.beginTransaction();
const androidSdkVersion = sdkVersion();

if (androidSdkVersion !== 21 && androidSdkVersion !== 22) {
transaction.remove(this._currentEntry.fragment);
} else {
// https://github.com/NativeScript/NativeScript/issues/5674
// HACK: Add and remove dummy fragment to workaround a Lollipop issue
// with inFragment passed as null when adding transition targets: https://android.googlesource.com/platform/frameworks/base.git/+/lollipop-release/core/java/android/app/BackStackRecord.java#1127
const dummyFragmentTag = "dummy";
const dummyFragment = this.createFragment(<BackstackEntry>{}, dummyFragmentTag);
transaction.replace(this.containerViewId, dummyFragment, dummyFragmentTag);
transaction.remove(dummyFragment);
}

transaction.commitAllowingStateLoss();
transaction.remove(this._currentEntry.fragment);
transaction.commitNowAllowingStateLoss();
}

private createFragment(backstackEntry: BackstackEntry, fragmentTag: string): android.support.v4.app.Fragment {
Expand Down
8 changes: 1 addition & 7 deletions tns-core-modules/ui/tab-view/tab-view.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,7 @@ function initializeNativeClasses() {

finishUpdate(container: android.view.ViewGroup): void {
if (this.mCurTransaction != null) {
if (android.os.Build.VERSION.SDK_INT >= 24) {
(<any>this.mCurTransaction).commitNowAllowingStateLoss();
} else {
this.mCurTransaction.commitAllowingStateLoss();
this.owner._getFragmentManager().executePendingTransactions();
}

(<any>this.mCurTransaction).commitNowAllowingStateLoss();
this.mCurTransaction = null;
}
}
Expand Down