File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { View } from '@nativescript/core';
2
2
import {
3
3
App ,
4
4
Component ,
5
+ ComponentPublicInstance ,
5
6
RendererElement ,
6
7
RendererNode ,
7
8
VNode ,
@@ -25,6 +26,7 @@ export const createNativeView = <T = View>(
25
26
contextOverrides ?: { reload ?( ) : void } ,
26
27
) => {
27
28
let isMounted = false ;
29
+ let vm : ComponentPublicInstance | null ;
28
30
const newApp = renderer . createApp ( component , props ) ;
29
31
// Destructure so as not to copy over the root app instance
30
32
const { app, ...rootContext } = rootApp . _context ;
@@ -35,7 +37,7 @@ export const createNativeView = <T = View>(
35
37
return {
36
38
context,
37
39
get vnode ( ) {
38
- return newApp . _instance ? .vnode ;
40
+ return vm ?. $ . vnode ;
39
41
} ,
40
42
get nativeView ( ) : T {
41
43
return this . vnode ?. el . nativeView ;
@@ -49,7 +51,7 @@ export const createNativeView = <T = View>(
49
51
newApp . _context [ key ] = context [ key ] ;
50
52
} ) ;
51
53
52
- newApp . mount ( root ) ;
54
+ vm = newApp . mount ( root ) ;
53
55
54
56
isMounted = true ;
55
57
@@ -58,6 +60,7 @@ export const createNativeView = <T = View>(
58
60
unmount ( ) {
59
61
if ( ! isMounted ) return ;
60
62
63
+ vm = null ;
61
64
newApp . unmount ( ) ;
62
65
63
66
isMounted = false ;
You can’t perform that action at this time.
0 commit comments