Skip to content

Commit dbce285

Browse files
committed
refactor: address pr comments
1 parent 9831312 commit dbce285

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

tns-core-modules/ui/core/view/view.android.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020

2121
import { Background, ad as androidBackground } from "../../styling/background";
2222
import { profile } from "../../../profiling";
23-
import { topmost } from "../../frame";
23+
import { topmost } from "../../frame/frame-stack";
2424
import { AndroidActivityBackPressedEventData, android as androidApp } from "../../../application";
2525

2626
export * from "./view-common";
@@ -265,6 +265,10 @@ export class View extends ViewCommon {
265265
}
266266
}
267267

268+
public _getChildFragmentManager(): android.support.v4.app.FragmentManager {
269+
return null;
270+
}
271+
268272
public _getFragmentManager(): android.support.v4.app.FragmentManager {
269273
let manager = this._manager;
270274
if (!manager) {
@@ -287,9 +291,9 @@ export class View extends ViewCommon {
287291
// - tabview -> frame1 (frame1 uses tabview item CHILD fm)
288292
// - frame1 -> tabview (tabview uses frame1 CHILD fm)
289293
// - frame1 -> tabview -> frame2 (tabview uses frame1 CHILD fm; frame2 uses tabview item CHILD fm)
290-
if (view.typeName === "Frame" || view.typeName === "TabView") {
294+
if (view._hasFragments) {
291295
if (frameOrTabFound) {
292-
manager = (<any>view)._getChildFragmentManager();
296+
manager = view._getChildFragmentManager();
293297
break;
294298
}
295299

@@ -425,6 +429,10 @@ export class View extends ViewCommon {
425429
return false;
426430
}
427431

432+
get _hasFragments(): boolean {
433+
return false;
434+
}
435+
428436
public layoutNativeView(left: number, top: number, right: number, bottom: number): void {
429437
if (this.nativeViewProtected) {
430438
this.nativeViewProtected.layout(left, top, right, bottom);
@@ -994,4 +1002,4 @@ createNativePercentLengthProperty({
9941002
createNativePercentLengthProperty({
9951003
setter: "_setMinHeightNative",
9961004
get setPixels() { return org.nativescript.widgets.ViewHelper.setMinHeight }
997-
});
1005+
});

tns-core-modules/ui/frame/frame.android.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ export class Frame extends FrameBase {
121121
return this._android;
122122
}
123123

124+
get _hasFragments(): boolean {
125+
return true;
126+
}
127+
124128
_onAttachedToWindow(): void {
125129
super._onAttachedToWindow();
126130
this._attachedToWindow = true;

tns-core-modules/ui/tab-view/tab-view.android.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ export class TabView extends TabViewBase {
361361
tabs.push(new WeakRef(this));
362362
}
363363

364+
get _hasFragments(): boolean {
365+
return true;
366+
}
367+
364368
public _getChildFragmentManager(): android.support.v4.app.FragmentManager {
365369
if (this._pagerAdapter) {
366370
const fragment: android.support.v4.app.Fragment = (<any>this._pagerAdapter).mCurrentPrimaryItem;

0 commit comments

Comments
 (0)