expo 55.0.0-canary-20251003-7b9d7ff → 55.0.0-canary-20251008-f2d1b4a
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/Expo.podspec +1 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ExpoBridgelessDevSupportManager.kt +137 -0
- package/android/src/main/java/expo/modules/ExpoDevSupportManagerFactory.kt +149 -0
- package/android/src/main/java/expo/modules/ExpoReactHostFactory.kt +37 -60
- package/android/src/main/java/expo/modules/ReactActivityDelegateWrapper.kt +0 -8
- package/build/async-require/hmr.d.ts +7 -7
- package/build/async-require/hmr.d.ts.map +1 -1
- package/build/dom/dom-internal.types.d.ts +11 -0
- package/build/dom/dom-internal.types.d.ts.map +1 -0
- package/build/dom/internal.d.ts +1 -0
- package/build/dom/internal.d.ts.map +1 -1
- package/build/dom/webview-wrapper.d.ts +2 -2
- package/build/dom/webview-wrapper.d.ts.map +1 -1
- package/bundledNativeModules.json +79 -79
- package/package.json +19 -18
- package/src/async-require/hmr.ts +55 -59
- package/src/dom/dom-entry.tsx +8 -8
- package/src/dom/dom-internal.types.ts +9 -0
- package/src/dom/internal.ts +2 -0
- package/src/dom/webview-wrapper.tsx +7 -4
- package/template.tgz +0 -0
- package/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt +0 -51
- package/android/src/main/java/expo/modules/ReactNativeHostWrapperBase.kt +0 -107
package/Expo.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -32,7 +32,7 @@ buildscript {
|
|
|
32
32
|
def reactNativeVersion = project.extensions.getByType(ExpoModuleExtension).reactNativeVersion
|
|
33
33
|
|
|
34
34
|
group = 'host.exp.exponent'
|
|
35
|
-
version = '55.0.0-canary-
|
|
35
|
+
version = '55.0.0-canary-20251008-f2d1b4a'
|
|
36
36
|
|
|
37
37
|
expoModule {
|
|
38
38
|
// We can't prebuild the module because it depends on the generated files.
|
|
@@ -43,7 +43,7 @@ android {
|
|
|
43
43
|
namespace "expo.core"
|
|
44
44
|
defaultConfig {
|
|
45
45
|
versionCode 1
|
|
46
|
-
versionName "55.0.0-canary-
|
|
46
|
+
versionName "55.0.0-canary-20251008-f2d1b4a"
|
|
47
47
|
consumerProguardFiles("proguard-rules.pro")
|
|
48
48
|
}
|
|
49
49
|
testOptions {
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
package expo.modules
|
|
9
|
+
|
|
10
|
+
import android.content.Context
|
|
11
|
+
import com.facebook.react.bridge.ReadableArray
|
|
12
|
+
import com.facebook.react.bridge.UiThreadUtil
|
|
13
|
+
import com.facebook.react.common.SurfaceDelegate
|
|
14
|
+
import com.facebook.react.common.SurfaceDelegateFactory
|
|
15
|
+
import com.facebook.react.devsupport.DevSupportManagerBase
|
|
16
|
+
import com.facebook.react.devsupport.ReactInstanceDevHelper
|
|
17
|
+
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener
|
|
18
|
+
import com.facebook.react.devsupport.interfaces.DevLoadingViewManager
|
|
19
|
+
import com.facebook.react.devsupport.interfaces.DevSupportManager
|
|
20
|
+
import com.facebook.react.devsupport.interfaces.PausedInDebuggerOverlayManager
|
|
21
|
+
import com.facebook.react.devsupport.interfaces.RedBoxHandler
|
|
22
|
+
import com.facebook.react.packagerconnection.RequestHandler
|
|
23
|
+
import expo.modules.logbox.ExpoLogBoxSurfaceDelegate
|
|
24
|
+
import com.facebook.react.devsupport.StackTraceHelper.convertJavaStackTrace
|
|
25
|
+
import com.facebook.react.devsupport.StackTraceHelper.convertJsStackTrace
|
|
26
|
+
import com.facebook.react.devsupport.interfaces.StackFrame
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An implementation of [DevSupportManager] that extends the functionality in
|
|
30
|
+
* [DevSupportManagerBase] with some additional, more flexible APIs for asynchronously loading the
|
|
31
|
+
* JS bundle.
|
|
32
|
+
*
|
|
33
|
+
* @constructor The primary constructor mirrors the same constructor we have for
|
|
34
|
+
* [BridgeDevSupportManager] and
|
|
35
|
+
* * is kept for backward compatibility.
|
|
36
|
+
*/
|
|
37
|
+
internal open class ExpoBridgelessDevSupportManager(
|
|
38
|
+
applicationContext: Context,
|
|
39
|
+
reactInstanceManagerHelper: ReactInstanceDevHelper,
|
|
40
|
+
packagerPathForJSBundleName: String?,
|
|
41
|
+
enableOnCreate: Boolean,
|
|
42
|
+
redBoxHandler: RedBoxHandler?,
|
|
43
|
+
devBundleDownloadListener: DevBundleDownloadListener?,
|
|
44
|
+
minNumShakes: Int,
|
|
45
|
+
customPackagerCommandHandlers: Map<String, RequestHandler>?,
|
|
46
|
+
surfaceDelegateFactory: SurfaceDelegateFactory?,
|
|
47
|
+
devLoadingViewManager: DevLoadingViewManager?,
|
|
48
|
+
pausedInDebuggerOverlayManager: PausedInDebuggerOverlayManager?
|
|
49
|
+
) :
|
|
50
|
+
DevSupportManagerBase(
|
|
51
|
+
applicationContext,
|
|
52
|
+
reactInstanceManagerHelper,
|
|
53
|
+
packagerPathForJSBundleName,
|
|
54
|
+
enableOnCreate,
|
|
55
|
+
redBoxHandler,
|
|
56
|
+
devBundleDownloadListener,
|
|
57
|
+
minNumShakes,
|
|
58
|
+
customPackagerCommandHandlers,
|
|
59
|
+
surfaceDelegateFactory,
|
|
60
|
+
devLoadingViewManager,
|
|
61
|
+
pausedInDebuggerOverlayManager
|
|
62
|
+
) {
|
|
63
|
+
|
|
64
|
+
override val uniqueTag: String
|
|
65
|
+
get() = "Bridgeless"
|
|
66
|
+
|
|
67
|
+
override fun handleReloadJS() {
|
|
68
|
+
UiThreadUtil.assertOnUiThread()
|
|
69
|
+
// dismiss redbox if exists
|
|
70
|
+
hideRedboxDialog()
|
|
71
|
+
reactInstanceDevHelper.reload("BridgelessDevSupportManager.handleReloadJS()")
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
internal class ExpoDevSupportManagerWithLogBoxOverride(
|
|
76
|
+
applicationContext: Context,
|
|
77
|
+
reactInstanceManagerHelper: ReactInstanceDevHelper,
|
|
78
|
+
packagerPathForJSBundleName: String?,
|
|
79
|
+
enableOnCreate: Boolean,
|
|
80
|
+
redBoxHandler: RedBoxHandler?,
|
|
81
|
+
devBundleDownloadListener: DevBundleDownloadListener?,
|
|
82
|
+
minNumShakes: Int,
|
|
83
|
+
customPackagerCommandHandlers: Map<String, RequestHandler>?,
|
|
84
|
+
surfaceDelegateFactory: SurfaceDelegateFactory?,
|
|
85
|
+
devLoadingViewManager: DevLoadingViewManager?,
|
|
86
|
+
pausedInDebuggerOverlayManager: PausedInDebuggerOverlayManager?
|
|
87
|
+
) :
|
|
88
|
+
ExpoBridgelessDevSupportManager(
|
|
89
|
+
applicationContext,
|
|
90
|
+
reactInstanceManagerHelper,
|
|
91
|
+
packagerPathForJSBundleName,
|
|
92
|
+
enableOnCreate,
|
|
93
|
+
redBoxHandler,
|
|
94
|
+
devBundleDownloadListener,
|
|
95
|
+
minNumShakes,
|
|
96
|
+
customPackagerCommandHandlers,
|
|
97
|
+
surfaceDelegateFactory,
|
|
98
|
+
devLoadingViewManager,
|
|
99
|
+
pausedInDebuggerOverlayManager
|
|
100
|
+
) {
|
|
101
|
+
|
|
102
|
+
private var redBoxSurfaceDelegate: SurfaceDelegate? = null
|
|
103
|
+
|
|
104
|
+
override fun hideRedboxDialog() {
|
|
105
|
+
redBoxSurfaceDelegate?.hide()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
override fun showNewJavaError(message: String?, e: Throwable) {
|
|
109
|
+
showNewError(message, convertJavaStackTrace(e))
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
override fun showNewJSError(message: String?, details: ReadableArray?, errorCookie: Int) {
|
|
113
|
+
showNewError(message, convertJsStackTrace(details))
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
private fun showNewError(message: String?, stack: Array<StackFrame>) {
|
|
117
|
+
UiThreadUtil.runOnUiThread {
|
|
118
|
+
lastErrorTitle = message
|
|
119
|
+
lastErrorStack = stack
|
|
120
|
+
|
|
121
|
+
if (redBoxSurfaceDelegate == null) {
|
|
122
|
+
this.redBoxSurfaceDelegate =
|
|
123
|
+
createSurfaceDelegate("RedBox")
|
|
124
|
+
?: ExpoLogBoxSurfaceDelegate(this@ExpoDevSupportManagerWithLogBoxOverride).apply {
|
|
125
|
+
createContentView("RedBox")
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (redBoxSurfaceDelegate?.isShowing() == true) {
|
|
130
|
+
// Sometimes errors cause multiple errors to be thrown in JS in quick succession. Only
|
|
131
|
+
// show the first and most actionable one.
|
|
132
|
+
return@runOnUiThread
|
|
133
|
+
}
|
|
134
|
+
redBoxSurfaceDelegate?.show()
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
package expo.modules
|
|
9
|
+
|
|
10
|
+
import android.content.Context
|
|
11
|
+
import com.facebook.react.common.SurfaceDelegateFactory
|
|
12
|
+
import com.facebook.react.common.build.ReactBuildConfig
|
|
13
|
+
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener
|
|
14
|
+
import com.facebook.react.devsupport.interfaces.DevLoadingViewManager
|
|
15
|
+
import com.facebook.react.devsupport.interfaces.DevSupportManager
|
|
16
|
+
import com.facebook.react.devsupport.interfaces.PausedInDebuggerOverlayManager
|
|
17
|
+
import com.facebook.react.devsupport.interfaces.RedBoxHandler
|
|
18
|
+
import com.facebook.react.packagerconnection.RequestHandler
|
|
19
|
+
import java.lang.StringBuilder
|
|
20
|
+
import com.facebook.react.devsupport.DevSupportManagerFactory
|
|
21
|
+
import com.facebook.react.devsupport.ReactInstanceDevHelper
|
|
22
|
+
import com.facebook.react.devsupport.ReleaseDevSupportManager
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A simple factory that creates instances of [DevSupportManager] implementations. Uses reflection
|
|
26
|
+
* to create BridgeDevSupportManager if it exists. This allows ProGuard to strip that class and its
|
|
27
|
+
* dependencies in release builds. If the class isn't found, [PerftestDevSupportManager] is returned
|
|
28
|
+
* instead.
|
|
29
|
+
*/
|
|
30
|
+
internal class ExpoDefaultDevSupportManagerFactory : DevSupportManagerFactory {
|
|
31
|
+
|
|
32
|
+
override fun create(
|
|
33
|
+
applicationContext: Context,
|
|
34
|
+
reactInstanceManagerHelper: ReactInstanceDevHelper,
|
|
35
|
+
packagerPathForJSBundleName: String?,
|
|
36
|
+
enableOnCreate: Boolean,
|
|
37
|
+
redBoxHandler: RedBoxHandler?,
|
|
38
|
+
devBundleDownloadListener: DevBundleDownloadListener?,
|
|
39
|
+
minNumShakes: Int,
|
|
40
|
+
customPackagerCommandHandlers: Map<String, RequestHandler>?,
|
|
41
|
+
surfaceDelegateFactory: SurfaceDelegateFactory?,
|
|
42
|
+
devLoadingViewManager: DevLoadingViewManager?,
|
|
43
|
+
pausedInDebuggerOverlayManager: PausedInDebuggerOverlayManager?
|
|
44
|
+
): DevSupportManager {
|
|
45
|
+
return if (!enableOnCreate) {
|
|
46
|
+
ReleaseDevSupportManager()
|
|
47
|
+
} else {
|
|
48
|
+
try {
|
|
49
|
+
// Developer support is enabled, we now must choose whether to return a DevSupportManager,
|
|
50
|
+
// or a more lean profiling-only PerftestDevSupportManager. We make the choice by first
|
|
51
|
+
// trying to return the full support DevSupportManager and if it fails, then just
|
|
52
|
+
// return PerftestDevSupportManager.
|
|
53
|
+
|
|
54
|
+
// ProGuard is surprisingly smart in this case and will keep a class if it detects a call
|
|
55
|
+
// to
|
|
56
|
+
// Class.forName() with a static string. So instead we generate a quasi-dynamic string to
|
|
57
|
+
// confuse it.
|
|
58
|
+
val className =
|
|
59
|
+
StringBuilder(DEVSUPPORT_IMPL_PACKAGE)
|
|
60
|
+
.append(".")
|
|
61
|
+
.append(DEVSUPPORT_IMPL_CLASS)
|
|
62
|
+
.toString()
|
|
63
|
+
val devSupportManagerClass = Class.forName(className)
|
|
64
|
+
val constructor =
|
|
65
|
+
devSupportManagerClass.getConstructor(
|
|
66
|
+
Context::class.java,
|
|
67
|
+
ReactInstanceDevHelper::class.java,
|
|
68
|
+
String::class.java,
|
|
69
|
+
Boolean::class.javaPrimitiveType,
|
|
70
|
+
RedBoxHandler::class.java,
|
|
71
|
+
DevBundleDownloadListener::class.java,
|
|
72
|
+
Int::class.javaPrimitiveType,
|
|
73
|
+
MutableMap::class.java,
|
|
74
|
+
SurfaceDelegateFactory::class.java,
|
|
75
|
+
DevLoadingViewManager::class.java,
|
|
76
|
+
PausedInDebuggerOverlayManager::class.java
|
|
77
|
+
)
|
|
78
|
+
constructor.newInstance(
|
|
79
|
+
applicationContext,
|
|
80
|
+
reactInstanceManagerHelper,
|
|
81
|
+
packagerPathForJSBundleName,
|
|
82
|
+
true,
|
|
83
|
+
redBoxHandler,
|
|
84
|
+
devBundleDownloadListener,
|
|
85
|
+
minNumShakes,
|
|
86
|
+
customPackagerCommandHandlers,
|
|
87
|
+
surfaceDelegateFactory,
|
|
88
|
+
devLoadingViewManager,
|
|
89
|
+
pausedInDebuggerOverlayManager
|
|
90
|
+
) as DevSupportManager
|
|
91
|
+
} catch (e: Exception) {
|
|
92
|
+
throw e
|
|
93
|
+
// Original implementation
|
|
94
|
+
// https://github.com/facebook/react-native/blob/50273758510a6d756494d05dc91055516c2a6aca/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.kt#L95
|
|
95
|
+
|
|
96
|
+
// React Native implementation fallback is PerftestDevSupportManager(applicationContext)
|
|
97
|
+
// but that's internal class we would have to vendor, so this impl re-throws.
|
|
98
|
+
// https://github.com/facebook/react-native/blob/50273758510a6d756494d05dc91055516c2a6aca/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PerftestDevSupportManager.kt#L17
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
override fun create(
|
|
104
|
+
applicationContext: Context,
|
|
105
|
+
reactInstanceManagerHelper: ReactInstanceDevHelper,
|
|
106
|
+
packagerPathForJSBundleName: String?,
|
|
107
|
+
enableOnCreate: Boolean,
|
|
108
|
+
redBoxHandler: RedBoxHandler?,
|
|
109
|
+
devBundleDownloadListener: DevBundleDownloadListener?,
|
|
110
|
+
minNumShakes: Int,
|
|
111
|
+
customPackagerCommandHandlers: Map<String, RequestHandler>?,
|
|
112
|
+
surfaceDelegateFactory: SurfaceDelegateFactory?,
|
|
113
|
+
devLoadingViewManager: DevLoadingViewManager?,
|
|
114
|
+
pausedInDebuggerOverlayManager: PausedInDebuggerOverlayManager?,
|
|
115
|
+
useDevSupport: Boolean
|
|
116
|
+
): DevSupportManager =
|
|
117
|
+
if (ReactBuildConfig.UNSTABLE_ENABLE_FUSEBOX_RELEASE) {
|
|
118
|
+
// Should never happen as ExpoDefaultDevSupportManagerFactory is only used if useDevSupport = true
|
|
119
|
+
throw Error("ExpoDefaultDevSupportManagerFactory supports debug builds only. ReactBuildConfig.UNSTABLE_ENABLE_FUSEBOX_RELEASE is unsupported.")
|
|
120
|
+
|
|
121
|
+
// Original implementation
|
|
122
|
+
// https://github.com/facebook/react-native/blob/50273758510a6d756494d05dc91055516c2a6aca/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.kt#L114
|
|
123
|
+
|
|
124
|
+
// React Native implementation uses PerftestDevSupportManager(applicationContext)
|
|
125
|
+
// but that's internal class we would have to vendor, so this impl re-throws.
|
|
126
|
+
// https://github.com/facebook/react-native/blob/50273758510a6d756494d05dc91055516c2a6aca/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PerftestDevSupportManager.kt#L17
|
|
127
|
+
} else if (useDevSupport) {
|
|
128
|
+
ExpoDevSupportManagerWithLogBoxOverride(
|
|
129
|
+
applicationContext,
|
|
130
|
+
reactInstanceManagerHelper,
|
|
131
|
+
packagerPathForJSBundleName,
|
|
132
|
+
enableOnCreate,
|
|
133
|
+
redBoxHandler,
|
|
134
|
+
devBundleDownloadListener,
|
|
135
|
+
minNumShakes,
|
|
136
|
+
customPackagerCommandHandlers,
|
|
137
|
+
surfaceDelegateFactory,
|
|
138
|
+
devLoadingViewManager,
|
|
139
|
+
pausedInDebuggerOverlayManager
|
|
140
|
+
)
|
|
141
|
+
} else {
|
|
142
|
+
ReleaseDevSupportManager()
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private companion object {
|
|
146
|
+
private const val DEVSUPPORT_IMPL_PACKAGE = "com.facebook.react.devsupport"
|
|
147
|
+
private const val DEVSUPPORT_IMPL_CLASS = "BridgeDevSupportManager"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -5,7 +5,6 @@ package expo.modules
|
|
|
5
5
|
import android.content.Context
|
|
6
6
|
import com.facebook.react.ReactHost
|
|
7
7
|
import com.facebook.react.ReactInstanceEventListener
|
|
8
|
-
import com.facebook.react.ReactNativeHost
|
|
9
8
|
import com.facebook.react.ReactPackage
|
|
10
9
|
import com.facebook.react.ReactPackageTurboModuleManagerDelegate
|
|
11
10
|
import com.facebook.react.bridge.JSBundleLoader
|
|
@@ -21,7 +20,10 @@ import com.facebook.react.runtime.ReactHostDelegate
|
|
|
21
20
|
import com.facebook.react.runtime.ReactHostImpl
|
|
22
21
|
import com.facebook.react.runtime.hermes.HermesInstance
|
|
23
22
|
import expo.modules.core.interfaces.ReactNativeHostHandler
|
|
23
|
+
import com.facebook.react.runtime.internal.bolts.Task
|
|
24
24
|
import java.lang.ref.WeakReference
|
|
25
|
+
import java.util.concurrent.Executors
|
|
26
|
+
import expo.modules.logbox.ExpoLogBoxBuildConfig
|
|
25
27
|
|
|
26
28
|
object ExpoReactHostFactory {
|
|
27
29
|
private var reactHost: ReactHost? = null
|
|
@@ -40,6 +42,24 @@ object ExpoReactHostFactory {
|
|
|
40
42
|
private val hostHandlers: List<ReactNativeHostHandler>
|
|
41
43
|
) : ReactHostDelegate {
|
|
42
44
|
|
|
45
|
+
val hostDelegateJsBundleFilePath: String? by lazy {
|
|
46
|
+
hostHandlers.asSequence()
|
|
47
|
+
.mapNotNull { it.getJSBundleFile(useDevSupport) }
|
|
48
|
+
.firstOrNull() ?: jsBundleFilePath
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
val hostDelegateJSBundleAssetPath: String? by lazy {
|
|
52
|
+
hostHandlers.asSequence()
|
|
53
|
+
.mapNotNull { it.getBundleAssetName(useDevSupport) }
|
|
54
|
+
.firstOrNull() ?: jsBundleAssetPath
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
val hostDelegateUseDeveloperSupport: Boolean by lazy {
|
|
58
|
+
hostHandlers.asSequence()
|
|
59
|
+
.mapNotNull { it.useDeveloperSupport }
|
|
60
|
+
.firstOrNull() ?: useDevSupport
|
|
61
|
+
}
|
|
62
|
+
|
|
43
63
|
// Keeps this `_jsBundleLoader` backing property for DevLauncher to replace its internal value
|
|
44
64
|
private var _jsBundleLoader: JSBundleLoader? = null
|
|
45
65
|
override val jsBundleLoader: JSBundleLoader
|
|
@@ -49,14 +69,14 @@ object ExpoReactHostFactory {
|
|
|
49
69
|
return backingJSBundleLoader
|
|
50
70
|
}
|
|
51
71
|
val context = weakContext.get() ?: throw IllegalStateException("Unable to get concrete Context")
|
|
52
|
-
|
|
72
|
+
hostDelegateJsBundleFilePath?.let { jsBundleFile ->
|
|
53
73
|
if (jsBundleFile.startsWith("assets://")) {
|
|
54
74
|
return JSBundleLoader.createAssetLoader(context, jsBundleFile, true)
|
|
55
75
|
}
|
|
56
76
|
return JSBundleLoader.createFileLoader(jsBundleFile)
|
|
57
77
|
}
|
|
58
78
|
|
|
59
|
-
return JSBundleLoader.createAssetLoader(context, "assets://$
|
|
79
|
+
return JSBundleLoader.createAssetLoader(context, "assets://$hostDelegateJSBundleAssetPath", true)
|
|
60
80
|
}
|
|
61
81
|
|
|
62
82
|
override val jsRuntimeFactory: JSRuntimeFactory
|
|
@@ -70,63 +90,9 @@ object ExpoReactHostFactory {
|
|
|
70
90
|
throw error
|
|
71
91
|
}
|
|
72
92
|
hostHandlers.forEach { handler ->
|
|
73
|
-
handler.onReactInstanceException(
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@OptIn(UnstableReactNativeAPI::class)
|
|
79
|
-
@JvmStatic
|
|
80
|
-
fun createFromReactNativeHost(
|
|
81
|
-
context: Context,
|
|
82
|
-
reactNativeHost: ReactNativeHost
|
|
83
|
-
): ReactHost {
|
|
84
|
-
require(reactNativeHost is ReactNativeHostWrapper) {
|
|
85
|
-
"You can call createFromReactNativeHost only with instances of ReactNativeHostWrapper"
|
|
86
|
-
}
|
|
87
|
-
if (reactHost == null) {
|
|
88
|
-
val useDeveloperSupport = reactNativeHost.useDeveloperSupport
|
|
89
|
-
val componentFactory = ComponentFactory()
|
|
90
|
-
DefaultComponentsRegistry.register(componentFactory)
|
|
91
|
-
|
|
92
|
-
reactNativeHost.reactNativeHostHandlers.forEach { handler ->
|
|
93
|
-
handler.onWillCreateReactInstance(useDeveloperSupport)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
val reactHostDelegate = ExpoReactHostDelegate(
|
|
97
|
-
WeakReference(context),
|
|
98
|
-
reactNativeHost.packages,
|
|
99
|
-
reactNativeHost.jsMainModuleName,
|
|
100
|
-
reactNativeHost.bundleAssetName,
|
|
101
|
-
reactNativeHost.jsBundleFile,
|
|
102
|
-
reactNativeHost.useDeveloperSupport,
|
|
103
|
-
hostHandlers = reactNativeHost.reactNativeHostHandlers
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
val reactHostImpl =
|
|
107
|
-
ReactHostImpl(
|
|
108
|
-
context,
|
|
109
|
-
reactHostDelegate,
|
|
110
|
-
componentFactory,
|
|
111
|
-
true,
|
|
112
|
-
useDeveloperSupport
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
reactNativeHost.reactNativeHostHandlers.forEach { handler ->
|
|
116
|
-
handler.onDidCreateDevSupportManager(reactHostImpl.devSupportManager)
|
|
93
|
+
handler.onReactInstanceException(hostDelegateUseDeveloperSupport, error)
|
|
117
94
|
}
|
|
118
|
-
|
|
119
|
-
reactHostImpl.addReactInstanceEventListener(object : ReactInstanceEventListener {
|
|
120
|
-
override fun onReactContextInitialized(context: ReactContext) {
|
|
121
|
-
reactNativeHost.reactNativeHostHandlers.forEach { handler ->
|
|
122
|
-
handler.onDidCreateReactInstance(useDeveloperSupport, context)
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
reactHost = reactHostImpl
|
|
128
95
|
}
|
|
129
|
-
return reactHost as ReactHost
|
|
130
96
|
}
|
|
131
97
|
|
|
132
98
|
@OptIn(UnstableReactNativeAPI::class)
|
|
@@ -162,14 +128,25 @@ object ExpoReactHostFactory {
|
|
|
162
128
|
handler.onWillCreateReactInstance(useDevSupport)
|
|
163
129
|
}
|
|
164
130
|
|
|
165
|
-
val reactHostImpl =
|
|
166
|
-
ReactHostImpl(
|
|
131
|
+
val reactHostImpl = when {
|
|
132
|
+
ExpoLogBoxBuildConfig.UNSTABLE_IS_ENABLED && useDevSupport -> ReactHostImpl(
|
|
133
|
+
context,
|
|
134
|
+
reactHostDelegate,
|
|
135
|
+
componentFactory,
|
|
136
|
+
Executors.newSingleThreadExecutor(),
|
|
137
|
+
Task.UI_THREAD_EXECUTOR,
|
|
138
|
+
allowPackagerServerAccess = true,
|
|
139
|
+
useDevSupport = true,
|
|
140
|
+
devSupportManagerFactory = ExpoDefaultDevSupportManagerFactory()
|
|
141
|
+
)
|
|
142
|
+
else -> ReactHostImpl(
|
|
167
143
|
context,
|
|
168
144
|
reactHostDelegate,
|
|
169
145
|
componentFactory,
|
|
170
146
|
true,
|
|
171
147
|
useDevSupport
|
|
172
148
|
)
|
|
149
|
+
}
|
|
173
150
|
|
|
174
151
|
hostHandlers.forEach { handler ->
|
|
175
152
|
handler.onDidCreateDevSupportManager(reactHostImpl.devSupportManager)
|
|
@@ -22,7 +22,6 @@ import com.facebook.react.ReactDelegate
|
|
|
22
22
|
import com.facebook.react.ReactHost
|
|
23
23
|
import com.facebook.react.ReactInstanceEventListener
|
|
24
24
|
import com.facebook.react.ReactInstanceManager
|
|
25
|
-
import com.facebook.react.ReactNativeHost
|
|
26
25
|
import com.facebook.react.ReactRootView
|
|
27
26
|
import com.facebook.react.bridge.ReactContext
|
|
28
27
|
import com.facebook.react.modules.core.PermissionListener
|
|
@@ -56,9 +55,6 @@ class ReactActivityDelegateWrapper(
|
|
|
56
55
|
private val reactActivityHandlers = ExpoModulesPackage.packageList
|
|
57
56
|
.flatMap { it.createReactActivityHandlers(activity) }
|
|
58
57
|
private val methodMap: ArrayMap<String, Method> = ArrayMap()
|
|
59
|
-
private val _reactNativeHost: ReactNativeHost by lazy {
|
|
60
|
-
invokeDelegateMethod("getReactNativeHost")
|
|
61
|
-
}
|
|
62
58
|
private val _reactHost: ReactHost? by lazy {
|
|
63
59
|
delegate.reactHost
|
|
64
60
|
}
|
|
@@ -103,10 +99,6 @@ class ReactActivityDelegateWrapper(
|
|
|
103
99
|
return invokeDelegateMethod("getReactDelegate")
|
|
104
100
|
}
|
|
105
101
|
|
|
106
|
-
override fun getReactNativeHost(): ReactNativeHost {
|
|
107
|
-
return _reactNativeHost
|
|
108
|
-
}
|
|
109
|
-
|
|
110
102
|
override fun getReactHost(): ReactHost? {
|
|
111
103
|
return _reactHost
|
|
112
104
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
type LogLevel = 'trace' | 'info' | 'warn' | 'error' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* HMR Client that receives from the server HMR updates and propagates them
|
|
4
|
+
* runtime to reflects those changes.
|
|
5
|
+
*/
|
|
6
|
+
declare const HMRClient: {
|
|
3
7
|
enable(): void;
|
|
4
8
|
disable(): void;
|
|
5
9
|
registerBundle(requestUrl: string): void;
|
|
6
10
|
log(level: LogLevel, data: any[]): void;
|
|
7
|
-
setup(
|
|
11
|
+
setup({ isEnabled }: {
|
|
8
12
|
isEnabled: boolean;
|
|
9
13
|
}): void;
|
|
14
|
+
_onMetroError(data: unknown): void;
|
|
10
15
|
};
|
|
11
|
-
/**
|
|
12
|
-
* HMR Client that receives from the server HMR updates and propagates them
|
|
13
|
-
* runtime to reflects those changes.
|
|
14
|
-
*/
|
|
15
|
-
declare const HMRClient: HMRClientNativeInterface;
|
|
16
16
|
export default HMRClient;
|
|
17
17
|
//# sourceMappingURL=hmr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmr.d.ts","sourceRoot":"","sources":["../../src/async-require/hmr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hmr.d.ts","sourceRoot":"","sources":["../../src/async-require/hmr.ts"],"names":[],"mappings":"AAqCA,KAAK,QAAQ,GACT,OAAO,GACP,MAAM,GACN,MAAM,GACN,OAAO,GACP,KAAK,GACL,OAAO,GACP,gBAAgB,GAChB,UAAU,GACV,OAAO,CAAC;AAMZ;;;GAGG;AACH,QAAA,MAAM,SAAS;;;+BAyCc,MAAM;eAMtB,QAAQ,QAAQ,GAAG,EAAE;yBAsCX;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE;wBAoGvB,OAAO;CAkC5B,CAAC;AA6DF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DOMProps } from './dom.types';
|
|
2
|
+
export interface DOMPropsInternal extends DOMProps {
|
|
3
|
+
/**
|
|
4
|
+
* Allows dynamically redirecting a component to a different source, for example prebuilt version.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
sourceOverride?: {
|
|
8
|
+
uri: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=dom-internal.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-internal.types.d.ts","sourceRoot":"","sources":["../../src/dom/dom-internal.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,gBAAiB,SAAQ,QAAQ;IAChD;;;OAGG;IACH,cAAc,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAClC"}
|
package/build/dom/internal.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/dom/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/dom/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEvD,cAAc,sBAAsB,CAAC;AAGrC,eAAO,MAAM,oBAAoB,EAAE,SAAS,GAAG,cAAc,aAAa,EAAE,oBACjE,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { DOMPropsInternal } from './dom-internal.types';
|
|
3
3
|
import ExpoDomWebView from './webview/ExpoDOMWebView';
|
|
4
4
|
import RNWebView from './webview/RNWebView';
|
|
5
5
|
type RawWebViewProps = React.ComponentProps<Exclude<typeof ExpoDomWebView, undefined>> & React.ComponentProps<Exclude<typeof RNWebView, undefined>>;
|
|
6
6
|
interface Props {
|
|
7
7
|
children?: any;
|
|
8
|
-
dom?:
|
|
8
|
+
dom?: DOMPropsInternal;
|
|
9
9
|
filePath: string;
|
|
10
10
|
ref: React.Ref<object>;
|
|
11
11
|
[propName: string]: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webview-wrapper.d.ts","sourceRoot":"","sources":["../../src/dom/webview-wrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,
|
|
1
|
+
{"version":3,"file":"webview-wrapper.d.ts","sourceRoot":"","sources":["../../src/dom/webview-wrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAWxD,OAAO,cAAc,MAAM,0BAA0B,CAAC;AACtD,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAG5C,KAAK,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,cAAc,EAAE,SAAS,CAAC,CAAC,GACpF,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAE7D,UAAU,KAAK;IACb,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,GAAG,CAAC,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7B;AAED,QAAA,MAAM,UAAU,mFAkMd,CAAC;AAiBH,wBAAgB,cAAc,CAC5B,iBAAiB,EAAE,OAAO,GACzB,KAAK,CAAC,yBAAyB,CAAC,eAAe,CAAC,CASlD;AAED,eAAe,UAAU,CAAC"}
|