@callstack/react-native-brownfield 3.5.1 → 3.6.1
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/CHANGELOG.md +20 -0
- package/ios/ExpoHostRuntime.swift +29 -18
- package/ios/ReactNativeBrownfield.swift +11 -0
- package/ios/ReactNativeHostRuntime.swift +17 -8
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @callstack/react-native-brownfield
|
|
2
2
|
|
|
3
|
+
## 3.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#305](https://github.com/callstack/react-native-brownfield/pull/305) [`eab53d9`](https://github.com/callstack/react-native-brownfield/commit/eab53d9f7b93f38e13185020fcf8a7af23df0d05) Thanks [@hurali97](https://github.com/hurali97)! - fix securiy vulnerabilities
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`eab53d9`](https://github.com/callstack/react-native-brownfield/commit/eab53d9f7b93f38e13185020fcf8a7af23df0d05)]:
|
|
10
|
+
- @callstack/brownfield-cli@3.6.1
|
|
11
|
+
|
|
12
|
+
## 3.6.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#301](https://github.com/callstack/react-native-brownfield/pull/301) [`c8816e9`](https://github.com/callstack/react-native-brownfield/commit/c8816e9418a472e0e8a388db105121381243e496) Thanks [@marcinszalski-callstack](https://github.com/marcinszalski-callstack)! - feat: add method to deallocate reactNativeFactory instance
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`5ac357b`](https://github.com/callstack/react-native-brownfield/commit/5ac357bb8802ecf3562d92be191f6681ae94a055)]:
|
|
21
|
+
- @callstack/brownfield-cli@3.6.0
|
|
22
|
+
|
|
3
23
|
## 3.5.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -28,16 +28,14 @@ final class ExpoHostRuntime {
|
|
|
28
28
|
public func startReactNative(onBundleLoaded: (() -> Void)?) {
|
|
29
29
|
guard reactNativeFactory == nil else { return }
|
|
30
30
|
|
|
31
|
-
let factory = ExpoReactNativeFactory(delegate: delegate)
|
|
32
|
-
delegate.dependencyProvider = RCTAppDependencyProvider()
|
|
33
|
-
|
|
34
|
-
reactNativeFactory = factory
|
|
35
|
-
|
|
36
31
|
let appDelegate = ExpoAppDelegate()
|
|
32
|
+
delegate.dependencyProvider = RCTAppDependencyProvider()
|
|
33
|
+
reactNativeFactory = ExpoReactNativeFactory(delegate: delegate)
|
|
37
34
|
// below: https://github.com/expo/expo/pull/39418/changes/5abd332b55b2ee7daee848284ed5f7fe1639452e
|
|
38
35
|
// has removed bindReactNativeFactory method from ExpoAppDelegate
|
|
39
36
|
#if !EXPO_SDK_GTE_55 // this define comes from the Brownfield Expo config plugin
|
|
40
|
-
|
|
37
|
+
guard let reactNativeFactory else { return }
|
|
38
|
+
appDelegate.bindReactNativeFactory(reactNativeFactory)
|
|
41
39
|
#endif
|
|
42
40
|
expoDelegate = appDelegate
|
|
43
41
|
|
|
@@ -46,6 +44,19 @@ final class ExpoHostRuntime {
|
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Stops React Native and releases the underlying factory instance.
|
|
49
|
+
*/
|
|
50
|
+
public func stopReactNative() {
|
|
51
|
+
if !Thread.isMainThread {
|
|
52
|
+
DispatchQueue.main.async { [weak self] in self?.stopReactNative() }
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
reactNativeFactory = nil
|
|
57
|
+
expoDelegate = nil
|
|
58
|
+
}
|
|
59
|
+
|
|
49
60
|
/**
|
|
50
61
|
* Path to JavaScript root.
|
|
51
62
|
* Default value: ".expo/.virtual-metro-entry"
|
|
@@ -125,19 +136,19 @@ final class ExpoHostRuntime {
|
|
|
125
136
|
// below: https://github.com/expo/expo/commit/2013760c46cde1404872d181a691da72fbf207a4
|
|
126
137
|
// has moved the recreateRootView method to ExpoReactNativeFactory
|
|
127
138
|
#if EXPO_SDK_GTE_55 // this define comes from the Brownfield Expo config plugin
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
139
|
+
return (reactNativeFactory as? ExpoReactNativeFactory)?.recreateRootView(
|
|
140
|
+
withBundleURL: bundleURL,
|
|
141
|
+
moduleName: moduleName,
|
|
142
|
+
initialProps: initialProps,
|
|
143
|
+
launchOptions: launchOptions
|
|
144
|
+
)
|
|
134
145
|
#else
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
146
|
+
return expoDelegate?.recreateRootView(
|
|
147
|
+
withBundleURL: bundleURL,
|
|
148
|
+
moduleName: moduleName,
|
|
149
|
+
initialProps: initialProps,
|
|
150
|
+
launchOptions: launchOptions
|
|
151
|
+
)
|
|
141
152
|
#endif
|
|
142
153
|
}
|
|
143
154
|
}
|
|
@@ -82,6 +82,17 @@ internal import Expo
|
|
|
82
82
|
#endif
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Stops React Native.
|
|
87
|
+
*/
|
|
88
|
+
@objc public func stopReactNative() {
|
|
89
|
+
#if canImport(Expo)
|
|
90
|
+
ExpoHostRuntime.shared.stopReactNative()
|
|
91
|
+
#else
|
|
92
|
+
ReactNativeHostRuntime.shared.stopReactNative()
|
|
93
|
+
#endif
|
|
94
|
+
}
|
|
95
|
+
|
|
85
96
|
@objc public func view(
|
|
86
97
|
moduleName: String,
|
|
87
98
|
initialProps: [AnyHashable: Any]?,
|
|
@@ -59,6 +59,7 @@ final class ReactNativeHostRuntime {
|
|
|
59
59
|
delegate.bundlePath = bundlePath
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
|
|
62
63
|
/**
|
|
63
64
|
* Bundle instance to lookup the JavaScript bundle.
|
|
64
65
|
* Default value: Bundle.main
|
|
@@ -68,6 +69,7 @@ final class ReactNativeHostRuntime {
|
|
|
68
69
|
delegate.bundle = bundle
|
|
69
70
|
}
|
|
70
71
|
}
|
|
72
|
+
|
|
71
73
|
/**
|
|
72
74
|
* Dynamic bundle URL provider called on every bundle load.
|
|
73
75
|
* When set, this overrides the default bundleURL() behavior in the delegate.
|
|
@@ -79,17 +81,12 @@ final class ReactNativeHostRuntime {
|
|
|
79
81
|
delegate.bundleURLOverride = bundleURLOverride
|
|
80
82
|
}
|
|
81
83
|
}
|
|
84
|
+
|
|
82
85
|
/**
|
|
83
86
|
* React Native factory instance created when starting React Native.
|
|
84
87
|
* Default value: nil
|
|
85
88
|
*/
|
|
86
89
|
private var reactNativeFactory: RCTReactNativeFactory? = nil
|
|
87
|
-
/**
|
|
88
|
-
* Root view factory used to create React Native views.
|
|
89
|
-
*/
|
|
90
|
-
lazy private var rootViewFactory: RCTRootViewFactory? = {
|
|
91
|
-
return reactNativeFactory?.rootViewFactory
|
|
92
|
-
}()
|
|
93
90
|
|
|
94
91
|
/**
|
|
95
92
|
* Starts React Native with default parameters.
|
|
@@ -98,12 +95,24 @@ final class ReactNativeHostRuntime {
|
|
|
98
95
|
startReactNative(onBundleLoaded: nil)
|
|
99
96
|
}
|
|
100
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Stops React Native and releases the underlying factory instance.
|
|
100
|
+
*/
|
|
101
|
+
public func stopReactNative() {
|
|
102
|
+
if !Thread.isMainThread {
|
|
103
|
+
DispatchQueue.main.async { [weak self] in self?.stopReactNative() }
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
reactNativeFactory = nil
|
|
108
|
+
}
|
|
109
|
+
|
|
101
110
|
public func view(
|
|
102
111
|
moduleName: String,
|
|
103
112
|
initialProps: [AnyHashable: Any]?,
|
|
104
113
|
launchOptions: [AnyHashable: Any]? = nil
|
|
105
114
|
) -> UIView? {
|
|
106
|
-
rootViewFactory
|
|
115
|
+
reactNativeFactory?.rootViewFactory.view(
|
|
107
116
|
withModuleName: moduleName,
|
|
108
117
|
initialProperties: initialProps,
|
|
109
118
|
launchOptions: launchOptions
|
|
@@ -145,7 +154,7 @@ final class ReactNativeHostRuntime {
|
|
|
145
154
|
guard reactNativeFactory == nil else { return }
|
|
146
155
|
|
|
147
156
|
delegate.dependencyProvider = RCTAppDependencyProvider()
|
|
148
|
-
|
|
157
|
+
reactNativeFactory = RCTReactNativeFactory(delegate: delegate)
|
|
149
158
|
|
|
150
159
|
if let onBundleLoaded {
|
|
151
160
|
jsBundleLoadObserver.observeOnce(onBundleLoaded: onBundleLoaded)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@callstack/react-native-brownfield",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Michal Chudziak <mike.chudziak@callstack.com>",
|
|
6
6
|
"bin": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@expo/config-plugins": "^54.0.4"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@callstack/brownfield-cli": "^3.
|
|
89
|
+
"@callstack/brownfield-cli": "^3.6.1"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@babel/core": "^7.25.2",
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
"nodemon": "^3.1.14",
|
|
104
104
|
"react": "19.1.1",
|
|
105
105
|
"react-native": "0.82.1",
|
|
106
|
-
"react-native-builder-bob": "^0.
|
|
106
|
+
"react-native-builder-bob": "^0.41.0",
|
|
107
107
|
"typescript": "5.9.3",
|
|
108
|
-
"vitest": "^4.1.
|
|
108
|
+
"vitest": "^4.1.4"
|
|
109
109
|
},
|
|
110
110
|
"codegenConfig": {
|
|
111
111
|
"name": "ReactNativeBrownfield",
|