@nativescript/core 8.8.5-next-11-03-2024-11647901894 → 8.8.5-next-11-19-2024-11905821145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nativescript/core",
|
|
3
|
-
"version": "8.8.5-next-11-
|
|
3
|
+
"version": "8.8.5-next-11-19-2024-11905821145",
|
|
4
4
|
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
|
|
5
5
|
"main": "index",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -2,6 +2,14 @@ import SwiftUI
|
|
|
2
2
|
import NativeScriptEmbedder
|
|
3
3
|
import UIKit
|
|
4
4
|
|
|
5
|
+
// Ensure runtime phases are called only once per app lifecycle
|
|
6
|
+
// In multi-scene apps, we need to ensure runtime doesn't reinit alongside main window
|
|
7
|
+
// For example, if @State is used to drive @Environment at the root level, we need to ensure
|
|
8
|
+
// a rerender of the main body doesn't cause runtime to cycle again
|
|
9
|
+
var hasMainInit = false
|
|
10
|
+
var hasMainBoot = false
|
|
11
|
+
var hasMainSetMainScene = false
|
|
12
|
+
|
|
5
13
|
@available(iOS 14.0, *)
|
|
6
14
|
struct NativeScriptMainWindow: Scene {
|
|
7
15
|
|
|
@@ -18,12 +26,18 @@ struct NativeScriptMainWindow: Scene {
|
|
|
18
26
|
// windowStyle is only supported on visionOS
|
|
19
27
|
WindowGroup {
|
|
20
28
|
NativeScriptAppView(found: { windowScene in
|
|
21
|
-
|
|
29
|
+
if (!hasMainSetMainScene) {
|
|
30
|
+
hasMainSetMainScene = true
|
|
31
|
+
NativeScriptEmbedder.sharedInstance().setWindowScene(windowScene)
|
|
32
|
+
}
|
|
22
33
|
}).onAppear {
|
|
23
34
|
// print("NativeScriptAppView onAppear")
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
if (!hasMainBoot) {
|
|
36
|
+
hasMainBoot = true
|
|
37
|
+
DispatchQueue.main.async {
|
|
38
|
+
NativeScriptEmbedder.boot()
|
|
39
|
+
}
|
|
40
|
+
}
|
|
27
41
|
}.onReceive(NotificationCenter.default
|
|
28
42
|
.publisher(for: NSNotification.Name("NativeScriptWindowOpen")), perform: { obj in
|
|
29
43
|
let info = parseWindowInfo(obj: obj)
|
|
@@ -68,9 +82,12 @@ struct NativeScriptMainWindow: Scene {
|
|
|
68
82
|
}
|
|
69
83
|
|
|
70
84
|
init() {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
if (!hasMainInit) {
|
|
86
|
+
hasMainInit = true
|
|
87
|
+
NativeScriptViewFactory.initShared()
|
|
88
|
+
NativeScriptEmbedder.sharedInstance().setDelegate(NativeScriptViewFactory.shared)
|
|
89
|
+
NativeScriptEmbedder.setup()
|
|
90
|
+
}
|
|
74
91
|
}
|
|
75
92
|
|
|
76
93
|
#if os(visionOS)
|