Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3948da5

Browse files
authored
fix: reference returned instance (#1068)
1 parentd8c1592 commit3948da5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/runtimeHelpers.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { View } from '@nativescript/core';
22
import{
33
App,
44
Component,
5+
ComponentPublicInstance,
56
RendererElement,
67
RendererNode,
78
VNode,
@@ -25,6 +26,7 @@ export const createNativeView = <T = View>(
2526
contextOverrides?:{reload?():void},
2627
)=>{
2728
letisMounted=false;
29+
letvm:ComponentPublicInstance|null;
2830
constnewApp=renderer.createApp(component,props);
2931
// Destructure so as not to copy over the root app instance
3032
const{ app, ...rootContext}=rootApp._context;
@@ -35,7 +37,7 @@ export const createNativeView = <T = View>(
3537
return{
3638
context,
3739
getvnode(){
38-
returnnewApp._instance?.vnode;
40+
returnvm?.$.vnode;
3941
},
4042
getnativeView():T{
4143
returnthis.vnode?.el.nativeView;
@@ -49,7 +51,7 @@ export const createNativeView = <T = View>(
4951
newApp._context[key]=context[key];
5052
});
5153

52-
newApp.mount(root);
54+
vm=newApp.mount(root);
5355

5456
isMounted=true;
5557

@@ -58,6 +60,7 @@ export const createNativeView = <T = View>(
5860
unmount(){
5961
if(!isMounted)return;
6062

63+
vm=null;
6164
newApp.unmount();
6265

6366
isMounted=false;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp