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

fix: reference returned instance#1068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletionssrc/runtimeHelpers.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ import { View } from '@nativescript/core';
import {
App,
Component,
ComponentPublicInstance,
RendererElement,
RendererNode,
VNode,
Expand All@@ -25,6 +26,7 @@ export const createNativeView = <T = View>(
contextOverrides?: { reload?(): void },
) => {
let isMounted = false;
let vm: ComponentPublicInstance | null;
const newApp = renderer.createApp(component, props);
// Destructure so as not to copy over the root app instance
const { app, ...rootContext } = rootApp._context;
Expand All@@ -35,7 +37,7 @@ export const createNativeView = <T = View>(
return {
context,
get vnode() {
returnnewApp._instance?.vnode;
returnvm?.$.vnode;
},
get nativeView(): T {
return this.vnode?.el.nativeView;
Expand All@@ -49,7 +51,7 @@ export const createNativeView = <T = View>(
newApp._context[key] = context[key];
});

newApp.mount(root);
vm =newApp.mount(root);

isMounted = true;

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

vm = null;
newApp.unmount();

isMounted = false;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp