1
- import { ViewBase , View , NavigatedData , NavigationTransition , Frame , BackstackEntry } from "@nativescript/core" ;
1
+ import { ViewBase , View , NavigatedData , NavigationTransition , Frame , BackstackEntry , Application } from "@nativescript/core" ;
2
2
import FrameElement from "./native/FrameElement" ;
3
3
import { createElement , DocumentNode , logger as log } from "./basicdom" ;
4
4
import PageElement from "./native/PageElement" ;
5
5
import NativeViewElementNode from "./native/NativeViewElementNode" ;
6
- import { getRootView } from "@nativescript/core/application" ;
7
6
import { _rootModalViews } from "@nativescript/core/ui/core/view" ;
8
7
9
8
export type ViewSpec = View | NativeViewElementNode < View >
@@ -22,7 +21,7 @@ export interface NavigationOptions<T> {
22
21
transitioniOS ?: NavigationTransition ;
23
22
}
24
23
25
- function resolveFrame ( frameSpec : FrameSpec ) : Frame {
24
+ export function resolveFrame ( frameSpec : FrameSpec ) : Frame {
26
25
let targetFrame : Frame ;
27
26
if ( ! frameSpec ) targetFrame = Frame . topmost ( ) ;
28
27
if ( frameSpec instanceof FrameElement ) targetFrame = frameSpec . nativeView as Frame ;
@@ -34,7 +33,7 @@ function resolveFrame(frameSpec: FrameSpec): Frame {
34
33
return targetFrame ;
35
34
}
36
35
37
- function resolveTarget ( viewSpec : ViewSpec ) : View {
36
+ export function resolveTarget ( viewSpec : ViewSpec ) : View {
38
37
if ( viewSpec instanceof View ) {
39
38
return viewSpec ;
40
39
}
@@ -43,7 +42,7 @@ function resolveTarget(viewSpec: ViewSpec): View {
43
42
44
43
interface ComponentInstanceInfo < T = any > { element : NativeViewElementNode < View > , pageInstance : SvelteComponent < T > }
45
44
46
- function resolveComponentElement < T > ( pageSpec : PageSpec < T > , props ?: T ) : ComponentInstanceInfo < T > {
45
+ export function resolveComponentElement < T > ( pageSpec : PageSpec < T > , props ?: T ) : ComponentInstanceInfo < T > {
47
46
let dummy = createElement ( 'fragment' , window . document as unknown as DocumentNode ) ;
48
47
let pageInstance = new pageSpec ( { target : dummy , props : props } ) ;
49
48
let element = dummy . firstElement ( ) as NativeViewElementNode < View > ;
@@ -140,7 +139,7 @@ export interface ShowModalOptions<T> {
140
139
export function showModal < T , U > ( modalOptions : ShowModalOptions < U > ) : Promise < T > {
141
140
let { page, props = { } , target, ...options } = modalOptions ;
142
141
143
- let modalLauncher = resolveTarget ( target ) || getRootView ( ) ;
142
+ let modalLauncher = resolveTarget ( target ) || Application . getRootView ( ) ;
144
143
145
144
let componentInstanceInfo = resolveComponentElement ( page , props ) ;
146
145
let modalView : ViewBase = componentInstanceInfo . element . nativeView ;
0 commit comments