From 6d82e60a49e9563b3c1fafd9d97125255bfe14b4 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Fri, 21 Sep 2018 19:13:59 +0300 Subject: [PATCH 1/7] fix-next(android): interact with nested fragments only thru child fragment manager --- tns-core-modules/ui/core/view/view.android.ts | 29 ++++++++++++++----- tns-core-modules/ui/frame/frame.android.ts | 9 +++++- tns-core-modules/ui/frame/frame.d.ts | 4 +++ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index 948763d864..cafad92f8e 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -3,10 +3,10 @@ import { Point, CustomLayoutView as CustomLayoutViewDefinition, dip } from "."; import { GestureTypes, GestureEventData } from "../../gestures"; // Types. import { - ViewCommon, layout, isEnabledProperty, originXProperty, originYProperty, automationTextProperty, isUserInteractionEnabledProperty, - traceEnabled, traceWrite, traceCategories, traceNotifyEvent, + Color, EventData, ViewCommon, layout, getAncestor, automationTextProperty, + isEnabledProperty, isUserInteractionEnabledProperty, originXProperty, originYProperty, paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, - Color, EventData + traceEnabled, traceWrite, traceCategories, traceNotifyEvent } from "./view-common"; import { @@ -20,7 +20,7 @@ import { import { Background, ad as androidBackground } from "../../styling/background"; import { profile } from "../../../profiling"; -import { topmost } from "../../frame/frame-stack"; +import { Frame, topmost } from "../../frame"; import { AndroidActivityBackPressedEventData, android as androidApp } from "../../../application"; export * from "./view-common"; @@ -274,11 +274,24 @@ export class View extends ViewCommon { if (dialogFragment) { manager = dialogFragment.getChildFragmentManager(); break; - } else { - // the case is needed because _dialogFragment is on View - // but parent may be ViewBase. - view = view.parent as View; } + + if (view instanceof Frame) { + // when interacting with nested fragments instead of using getSupportFragmentManager + // we must always use getChildFragmentManager instead + const parentFrame: Frame = getAncestor(view, Frame); + if (parentFrame) { + const backstackEntry = parentFrame._currentEntry || parentFrame._executingEntry; + if (backstackEntry && backstackEntry.fragment && backstackEntry.fragment.isAdded()) { + manager = backstackEntry.fragment.getChildFragmentManager(); + break; + } + } + } + + // the case is needed because _dialogFragment is on View + // but parent may be ViewBase. + view = view.parent as View; } if (!manager && this._context) { diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index e0c8ab5561..07da96037e 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -186,7 +186,14 @@ export class Frame extends FrameBase { } private disposeCurrentFragment(): void { - if (!this._currentEntry || !this._currentEntry.fragment) { + // when interacting with nested fragments it seems Android is smart enough + // to automatically remove child fragments when parent fragment is removed; + // however, we must add a fragment.isAdded() guard as our logic will try to + // explicitly remove the already removed child fragment causing an + // IllegalStateException: Fragment has not been attached yet. + if (!this._currentEntry || + !this._currentEntry.fragment || + !this._currentEntry.fragment.isAdded()) { return; } diff --git a/tns-core-modules/ui/frame/frame.d.ts b/tns-core-modules/ui/frame/frame.d.ts index b18af7387e..38638d553b 100644 --- a/tns-core-modules/ui/frame/frame.d.ts +++ b/tns-core-modules/ui/frame/frame.d.ts @@ -125,6 +125,10 @@ export class Frame extends View { * @private */ _currentEntry: BackstackEntry; + /** + * @private + */ + _executingEntry: BackstackEntry; /** * @private */ From dccf69fa1f06999b26ae0ddff92613ca591beba1 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Wed, 26 Sep 2018 19:15:20 +0300 Subject: [PATCH 2/7] fix-next(android): tab/frame fragments thru child fm --- tns-core-modules/ui/core/view/view.android.ts | 39 +++++++++++-------- tns-core-modules/ui/frame/frame.android.ts | 9 +++++ .../ui/tab-view/tab-view.android.ts | 11 ++++++ 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index cafad92f8e..63a0248452 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -3,10 +3,10 @@ import { Point, CustomLayoutView as CustomLayoutViewDefinition, dip } from "."; import { GestureTypes, GestureEventData } from "../../gestures"; // Types. import { - Color, EventData, ViewCommon, layout, getAncestor, automationTextProperty, - isEnabledProperty, isUserInteractionEnabledProperty, originXProperty, originYProperty, + ViewCommon, layout, isEnabledProperty, originXProperty, originYProperty, automationTextProperty, isUserInteractionEnabledProperty, + traceEnabled, traceWrite, traceCategories, traceNotifyEvent, paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, - traceEnabled, traceWrite, traceCategories, traceNotifyEvent + Color, EventData } from "./view-common"; import { @@ -20,7 +20,7 @@ import { import { Background, ad as androidBackground } from "../../styling/background"; import { profile } from "../../../profiling"; -import { Frame, topmost } from "../../frame"; +import { topmost } from "../../frame"; import { AndroidActivityBackPressedEventData, android as androidApp } from "../../../application"; export * from "./view-common"; @@ -269,24 +269,31 @@ export class View extends ViewCommon { let manager = this._manager; if (!manager) { let view: View = this; + let frameOrTabFound = false; while (view) { + // when interacting with nested fragments instead of using getSupportFragmentManager + // we must always use getChildFragmentManager instead; + // we have three sources of fragments -- Frame fragments, TabViewItem fragments, and + // modal dialog fragments + + // modal -> frame / tabview (frame / tabview use modal CHILD fm) const dialogFragment = view._dialogFragment; if (dialogFragment) { manager = dialogFragment.getChildFragmentManager(); break; } - - if (view instanceof Frame) { - // when interacting with nested fragments instead of using getSupportFragmentManager - // we must always use getChildFragmentManager instead - const parentFrame: Frame = getAncestor(view, Frame); - if (parentFrame) { - const backstackEntry = parentFrame._currentEntry || parentFrame._executingEntry; - if (backstackEntry && backstackEntry.fragment && backstackEntry.fragment.isAdded()) { - manager = backstackEntry.fragment.getChildFragmentManager(); - break; - } + + // - frame1 -> frame2 (frame2 uses frame1 CHILD fm) + // - tabview -> frame1 (frame1 uses tabview item CHILD fm) + // - frame1 -> tabview (tabview uses frame1 CHILD fm) + // - frame1 -> tabview -> frame2 (tabview uses frame1 CHILD fm; frame2 uses tabview item CHILD fm) + if (view.typeName === "Frame" || view.typeName === "TabView") { + if (frameOrTabFound) { + manager = (view)._getChildFragmentManager(); + break; } + + frameOrTabFound = true; } // the case is needed because _dialogFragment is on View @@ -987,4 +994,4 @@ createNativePercentLengthProperty({ createNativePercentLengthProperty({ setter: "_setMinHeightNative", get setPixels() { return org.nativescript.widgets.ViewHelper.setMinHeight } -}); \ No newline at end of file +}); diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index 07da96037e..318f776f4d 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -175,6 +175,15 @@ export class Frame extends FrameBase { } } + public _getChildFragmentManager() { + const backstackEntry = this._executingEntry || this._currentEntry; + if (backstackEntry && backstackEntry.fragment && backstackEntry.fragment.isAdded()) { + return backstackEntry.fragment.getChildFragmentManager(); + } + + return null; + } + _onRootViewReset(): void { this.disposeCurrentFragment(); super._onRootViewReset(); diff --git a/tns-core-modules/ui/tab-view/tab-view.android.ts b/tns-core-modules/ui/tab-view/tab-view.android.ts index c8893bc984..e98c923ece 100644 --- a/tns-core-modules/ui/tab-view/tab-view.android.ts +++ b/tns-core-modules/ui/tab-view/tab-view.android.ts @@ -361,6 +361,17 @@ export class TabView extends TabViewBase { tabs.push(new WeakRef(this)); } + public _getChildFragmentManager(): android.support.v4.app.FragmentManager { + if (this._pagerAdapter) { + const fragment: android.support.v4.app.Fragment = (this._pagerAdapter).mCurrentPrimaryItem; + if (fragment && fragment.isAdded()) { + return fragment.getChildFragmentManager(); + } + } + + return null; + } + public onItemsChanged(oldItems: TabViewItem[], newItems: TabViewItem[]): void { super.onItemsChanged(oldItems, newItems); From 32b3f41a0c7ae7bca9d7a4a12013856728ca918e Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Mon, 1 Oct 2018 15:05:06 +0300 Subject: [PATCH 3/7] refactor: address pr comments --- tns-core-modules/ui/core/view/view.android.ts | 16 ++++++++++++---- tns-core-modules/ui/frame/frame.android.ts | 4 ++++ tns-core-modules/ui/tab-view/tab-view.android.ts | 4 ++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index 63a0248452..4cf235ae90 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -20,7 +20,7 @@ import { import { Background, ad as androidBackground } from "../../styling/background"; import { profile } from "../../../profiling"; -import { topmost } from "../../frame"; +import { topmost } from "../../frame/frame-stack"; import { AndroidActivityBackPressedEventData, android as androidApp } from "../../../application"; export * from "./view-common"; @@ -265,6 +265,10 @@ export class View extends ViewCommon { } } + public _getChildFragmentManager(): android.support.v4.app.FragmentManager { + return null; + } + public _getFragmentManager(): android.support.v4.app.FragmentManager { let manager = this._manager; if (!manager) { @@ -287,9 +291,9 @@ export class View extends ViewCommon { // - tabview -> frame1 (frame1 uses tabview item CHILD fm) // - frame1 -> tabview (tabview uses frame1 CHILD fm) // - frame1 -> tabview -> frame2 (tabview uses frame1 CHILD fm; frame2 uses tabview item CHILD fm) - if (view.typeName === "Frame" || view.typeName === "TabView") { + if (view._hasFragments) { if (frameOrTabFound) { - manager = (view)._getChildFragmentManager(); + manager = view._getChildFragmentManager(); break; } @@ -425,6 +429,10 @@ export class View extends ViewCommon { return false; } + get _hasFragments(): boolean { + return false; + } + public layoutNativeView(left: number, top: number, right: number, bottom: number): void { if (this.nativeViewProtected) { this.nativeViewProtected.layout(left, top, right, bottom); @@ -994,4 +1002,4 @@ createNativePercentLengthProperty({ createNativePercentLengthProperty({ setter: "_setMinHeightNative", get setPixels() { return org.nativescript.widgets.ViewHelper.setMinHeight } -}); +}); \ No newline at end of file diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index 318f776f4d..c8ab860465 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -121,6 +121,10 @@ export class Frame extends FrameBase { return this._android; } + get _hasFragments(): boolean { + return true; + } + _onAttachedToWindow(): void { super._onAttachedToWindow(); this._attachedToWindow = true; diff --git a/tns-core-modules/ui/tab-view/tab-view.android.ts b/tns-core-modules/ui/tab-view/tab-view.android.ts index e98c923ece..0cabdbf00f 100644 --- a/tns-core-modules/ui/tab-view/tab-view.android.ts +++ b/tns-core-modules/ui/tab-view/tab-view.android.ts @@ -361,6 +361,10 @@ export class TabView extends TabViewBase { tabs.push(new WeakRef(this)); } + get _hasFragments(): boolean { + return true; + } + public _getChildFragmentManager(): android.support.v4.app.FragmentManager { if (this._pagerAdapter) { const fragment: android.support.v4.app.Fragment = (this._pagerAdapter).mCurrentPrimaryItem; From 0206ae70998671d408408d4be5fdafafd5f902bd Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Mon, 8 Oct 2018 16:20:58 +0300 Subject: [PATCH 4/7] fix: tab item child fm retrieval --- tns-core-modules/ui/core/view/view.android.ts | 6 ++-- .../ui/tab-view/tab-view.android.ts | 33 ++++++++++++------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index 4cf235ae90..1c0fd59cb3 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -273,7 +273,7 @@ export class View extends ViewCommon { let manager = this._manager; if (!manager) { let view: View = this; - let frameOrTabFound = false; + let frameOrTabViewItemFound = false; while (view) { // when interacting with nested fragments instead of using getSupportFragmentManager // we must always use getChildFragmentManager instead; @@ -292,12 +292,12 @@ export class View extends ViewCommon { // - frame1 -> tabview (tabview uses frame1 CHILD fm) // - frame1 -> tabview -> frame2 (tabview uses frame1 CHILD fm; frame2 uses tabview item CHILD fm) if (view._hasFragments) { - if (frameOrTabFound) { + if (frameOrTabViewItemFound) { manager = view._getChildFragmentManager(); break; } - frameOrTabFound = true; + frameOrTabViewItemFound = true; } // the case is needed because _dialogFragment is on View diff --git a/tns-core-modules/ui/tab-view/tab-view.android.ts b/tns-core-modules/ui/tab-view/tab-view.android.ts index 0cabdbf00f..17e23fa90a 100644 --- a/tns-core-modules/ui/tab-view/tab-view.android.ts +++ b/tns-core-modules/ui/tab-view/tab-view.android.ts @@ -260,6 +260,10 @@ export class TabViewItem extends TabViewItemBase { public index: number; private _defaultTransformationMethod: android.text.method.TransformationMethod; + get _hasFragments(): boolean { + return true; + } + public initNativeView(): void { super.initNativeView(); if (this.nativeViewProtected) { @@ -297,6 +301,24 @@ export class TabViewItem extends TabViewItemBase { } } + public _getChildFragmentManager(): android.support.v4.app.FragmentManager { + const tabView = this.parent as TabView; + let tabFragment = null; + const manager = tabView._getFragmentManager(); + for (let fragment of (>manager.getFragments().toArray())) { + if (fragment.index === this.index) { + tabFragment = fragment; + break; + } + } + + if (!tabFragment) { + throw new Error(`Could not get child fragment manager for tab item with index ${this.index}`); + } + + return tabFragment.getChildFragmentManager(); + } + [fontSizeProperty.getDefault](): { nativeSize: number } { return { nativeSize: this.nativeViewProtected.getTextSize() }; } @@ -365,17 +387,6 @@ export class TabView extends TabViewBase { return true; } - public _getChildFragmentManager(): android.support.v4.app.FragmentManager { - if (this._pagerAdapter) { - const fragment: android.support.v4.app.Fragment = (this._pagerAdapter).mCurrentPrimaryItem; - if (fragment && fragment.isAdded()) { - return fragment.getChildFragmentManager(); - } - } - - return null; - } - public onItemsChanged(oldItems: TabViewItem[], newItems: TabViewItem[]): void { super.onItemsChanged(oldItems, newItems); From bf0865a015eb3aae6526ee9efc5317a360c82d60 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Tue, 9 Oct 2018 09:55:14 +0300 Subject: [PATCH 5/7] fix: dispose tab fragments on reset --- tests/app/ui/tab-view/tab-view-root-tests.ts | 4 ++-- tns-core-modules/ui/frame/frame.android.ts | 2 +- .../ui/tab-view/tab-view.android.ts | 18 ++++++++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/tests/app/ui/tab-view/tab-view-root-tests.ts b/tests/app/ui/tab-view/tab-view-root-tests.ts index 2d2ab6fbe1..2a354aff46 100644 --- a/tests/app/ui/tab-view/tab-view-root-tests.ts +++ b/tests/app/ui/tab-view/tab-view-root-tests.ts @@ -67,11 +67,11 @@ export function test_frame_topmost_matches_selectedIndex() { create: () => tabView }; - waitUntilNavigatedToMaxTimeout([items[0].page], () => _resetRootView(entry)); + waitUntilNavigatedToMaxTimeout([items[0].page, items[1].page], () => _resetRootView(entry)); TKUnit.assertEqual(topmost().id, "Tab0 Frame0"); - waitUntilNavigatedToMaxTimeout([items[1].page], () => tabView.selectedIndex = 1); + tabView.selectedIndex = 1; TKUnit.assertEqual(topmost().id, "Tab1 Frame1"); } diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index c8ab860465..fad8bf09e0 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -188,7 +188,7 @@ export class Frame extends FrameBase { return null; } - _onRootViewReset(): void { + public _onRootViewReset(): void { this.disposeCurrentFragment(); super._onRootViewReset(); } diff --git a/tns-core-modules/ui/tab-view/tab-view.android.ts b/tns-core-modules/ui/tab-view/tab-view.android.ts index 17e23fa90a..91bf8c989f 100644 --- a/tns-core-modules/ui/tab-view/tab-view.android.ts +++ b/tns-core-modules/ui/tab-view/tab-view.android.ts @@ -304,8 +304,8 @@ export class TabViewItem extends TabViewItemBase { public _getChildFragmentManager(): android.support.v4.app.FragmentManager { const tabView = this.parent as TabView; let tabFragment = null; - const manager = tabView._getFragmentManager(); - for (let fragment of (>manager.getFragments().toArray())) { + const fragmentManager = tabView._getFragmentManager(); + for (let fragment of (>fragmentManager.getFragments().toArray())) { if (fragment.index === this.index) { tabFragment = fragment; break; @@ -538,6 +538,20 @@ export class TabView extends TabViewBase { return false; } + public _onRootViewReset(): void { + this.disposeCurrentFragments(); + super._onRootViewReset(); + } + + private disposeCurrentFragments(): void { + const fragmentManager = this._getFragmentManager(); + const transaction = fragmentManager.beginTransaction(); + for (let fragment of (>fragmentManager.getFragments().toArray())) { + transaction.remove(fragment); + } + transaction.commitNowAllowingStateLoss(); + } + private shouldUpdateAdapter(items: Array) { if (!this._pagerAdapter) { return false; From d8b1135e3e2529f8968bd0450ca73837a34792e1 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Wed, 10 Oct 2018 18:25:16 +0300 Subject: [PATCH 6/7] chore: fix ios test --- tests/app/ui/tab-view/tab-view-root-tests.ts | 25 ++++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/app/ui/tab-view/tab-view-root-tests.ts b/tests/app/ui/tab-view/tab-view-root-tests.ts index 2a354aff46..18d0fc99ad 100644 --- a/tests/app/ui/tab-view/tab-view-root-tests.ts +++ b/tests/app/ui/tab-view/tab-view-root-tests.ts @@ -1,13 +1,12 @@ -import * as helper from "../helper"; import TKUnit = require("../../TKUnit"); -import { isIOS, isAndroid } from "tns-core-modules/platform"; +import { isAndroid } from "tns-core-modules/platform"; import { _resetRootView } from "tns-core-modules/application/"; import { Frame, NavigationEntry, topmost } from "tns-core-modules/ui/frame"; import { Page } from "tns-core-modules/ui/page"; import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view"; function waitUntilNavigatedToMaxTimeout(pages: Page[], action: Function) { - const maxTimeout = 5; + const maxTimeout = 8; let completed = 0; function navigatedTo(args) { args.object.page.off("navigatedTo", navigatedTo); @@ -67,13 +66,19 @@ export function test_frame_topmost_matches_selectedIndex() { create: () => tabView }; - waitUntilNavigatedToMaxTimeout([items[0].page, items[1].page], () => _resetRootView(entry)); - - TKUnit.assertEqual(topmost().id, "Tab0 Frame0"); - - tabView.selectedIndex = 1; - - TKUnit.assertEqual(topmost().id, "Tab1 Frame1"); + if (isAndroid) { + waitUntilNavigatedToMaxTimeout([items[0].page, items[1].page], () => _resetRootView(entry)); + TKUnit.assertEqual(topmost().id, "Tab0 Frame0"); + + tabView.selectedIndex = 1; + TKUnit.assertEqual(topmost().id, "Tab1 Frame1"); + } else { + waitUntilNavigatedToMaxTimeout([items[0].page], () => _resetRootView(entry)); + TKUnit.assertEqual(topmost().id, "Tab0 Frame0"); + + waitUntilNavigatedToMaxTimeout([items[1].page], () => tabView.selectedIndex = 1); + TKUnit.assertEqual(topmost().id, "Tab1 Frame1"); + } } export function test_offset_zero_should_raise_same_events() { From 7a847ae4699130dc2421bf16a0467e38f0a68800 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Thu, 11 Oct 2018 16:10:13 +0300 Subject: [PATCH 7/7] fix(android): modals should use root fm --- tns-core-modules/ui/core/view/view.android.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index 1c0fd59cb3..4b1bfaab4a 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -234,6 +234,7 @@ export class View extends ViewCommon { private layoutChangeListenerIsSet: boolean; private layoutChangeListener: android.view.View.OnLayoutChangeListener; private _manager: android.support.v4.app.FragmentManager; + private _rootManager: android.support.v4.app.FragmentManager; nativeViewProtected: android.view.View; @@ -269,6 +270,14 @@ export class View extends ViewCommon { return null; } + public _getRootFragmentManager(): android.support.v4.app.FragmentManager { + if (!this._rootManager && this._context) { + this._rootManager = (this._context).getSupportFragmentManager(); + } + + return this._rootManager; + } + public _getFragmentManager(): android.support.v4.app.FragmentManager { let manager = this._manager; if (!manager) { @@ -318,6 +327,7 @@ export class View extends ViewCommon { @profile public onLoaded() { this._manager = null; + this._rootManager = null; super.onLoaded(); this.setOnTouchListener(); } @@ -331,6 +341,7 @@ export class View extends ViewCommon { } this._manager = null; + this._rootManager = null; super.onUnloaded(); } @@ -599,7 +610,7 @@ export class View extends ViewCommon { this._dialogFragment = df; this._raiseShowingModallyEvent(); - this._dialogFragment.show(parent._getFragmentManager(), this._domId.toString()); + this._dialogFragment.show(parent._getRootFragmentManager(), this._domId.toString()); } protected _hideNativeModalView(parent: View) {