expo-modules-core 58.0.14 → 58.0.15
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 +14 -0
- package/android/build.gradle +2 -2
- package/android/prebuilt/metadata.json +1 -1
- package/android/prebuilt/native-libs.tar.xz +0 -0
- package/android/proguard-rules.pro +34 -0
- package/android/src/main/java/expo/modules/kotlin/ExpoBridgeModule.kt +20 -4
- package/android/src/main/java/expo/modules/kotlin/defaultmodules/NativeModulesProxyModule.kt +7 -3
- package/android/src/main/java/expo/modules/kotlin/views/ShadowNodeProxy.kt +21 -3
- package/ios/Core/Classes/ClassDefinition.swift +5 -0
- package/ios/Core/Exceptions/CommonExceptions.swift +9 -0
- package/ios/Core/Exceptions/Exception.swift +13 -0
- package/ios/JS/ExpoRuntimeInstaller.swift +3 -4
- package/package.json +3 -3
- package/prebuilds/output/debug/xcframeworks/ExpoModulesCore.tar.gz +0 -0
- package/prebuilds/output/debug/xcframeworks/ExpoModulesWorklets.tar.gz +0 -0
- package/prebuilds/output/release/xcframeworks/ExpoModulesCore.tar.gz +0 -0
- package/prebuilds/output/release/xcframeworks/ExpoModulesWorklets.tar.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [Android] Fix record arguments without `@OptimizedRecord` (such as `ImagePickerOptions` in older `expo-image-picker` versions) failing to convert in minified release builds with `The 1st argument cannot be cast to type ...` caused by a `NullPointerException`. Keep the `@Field` annotation class from being renamed by R8. ([#51206](https://github.com/expo/expo/pull/51206) by [@SoSerious194](https://github.com/SoSerious194))
|
|
8
|
+
- [Android] Fix release builds crashing at launch when the app uses an Expo Modules API 2.0 module, such as `expo-crypto`. R8 removed classes and members that the v2 runtime reaches through reflection and JNI. ([#51204](https://github.com/expo/expo/pull/51204) by [@Kudo](https://github.com/Kudo))
|
|
9
|
+
- [Android] Fixed Expo modules not receiving `OnCreate` when JavaScript reaches the JSI `NativeModulesProxy` before the legacy one, for example with lazy imports, which made modules like `expo-web-browser` fail on first use. Its constants are read lazily again, as before #46964. ([#51310](https://github.com/expo/expo/pull/51310) by [@alanjhughes](https://github.com/alanjhughes))
|
|
10
|
+
- [iOS] Fixed JavaScript errors created from native `Exception`s using the exception's debug description as their `message`, which prefixed it with the Swift type name and appended the native `file:line` (e.g. `MyException: reason (at MyModule.swift:42)`). The message is the exception's `description` again, as before the JSI rewrite and as on Android. `Exception.message` can now be overridden by subclasses; subclasses that already declare a `message` property need to mark it as `override`. ([#51210](https://github.com/expo/expo/pull/51210) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
|
11
|
+
- [Android] Fix views sized by Jetpack Compose, such as `RNHostView` in a `ModalBottomSheet`, that kept their old size until the keyboard animation ended when the keyboard was dismissed with the predictive back gesture. ([#51083](https://github.com/expo/expo/pull/51083) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
|
|
12
|
+
- [iOS] Throw when JavaScript constructs a shared object class that has no way to build its native instance, instead of returning an object that fails at its first member access. ([#51171](https://github.com/expo/expo/pull/51171) by [@tsapeta](https://github.com/tsapeta))
|
|
13
|
+
- [Android] Warn instead of failing silently when `installModules()` gives up waiting for an active `ReactInstance`. Previously JSI interop was installed into a context with no active instance and the method still returned `true`, so the first visible symptom was `globalThis.expo` being undefined in JS. ([#49801](https://github.com/expo/expo/pull/49801) by [@JeffreyKlug](https://github.com/JeffreyKlug))
|
|
14
|
+
- Updated dependencies. ([#51129](https://github.com/expo/expo/pull/51129), [#51234](https://github.com/expo/expo/pull/51234))
|
|
15
|
+
- expo-modules-jsi@58.0.10
|
|
16
|
+
|
|
3
17
|
## 58.0.14
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/android/build.gradle
CHANGED
|
@@ -46,7 +46,7 @@ if (shouldIncludeCompose) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
group = 'host.exp.exponent'
|
|
49
|
-
version = '58.0.
|
|
49
|
+
version = '58.0.15'
|
|
50
50
|
|
|
51
51
|
def isExpoModulesCoreTests = {
|
|
52
52
|
Gradle gradle = getGradle()
|
|
@@ -175,7 +175,7 @@ android {
|
|
|
175
175
|
defaultConfig {
|
|
176
176
|
consumerProguardFiles 'proguard-rules.pro'
|
|
177
177
|
versionCode 1
|
|
178
|
-
versionName "58.0.
|
|
178
|
+
versionName "58.0.15"
|
|
179
179
|
buildConfigField "String", "EXPO_MODULES_CORE_VERSION", "\"${versionName}\""
|
|
180
180
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", "true"
|
|
181
181
|
|
|
Binary file
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
*;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
# RecordTypeConverter reads `Field.key` through reflection to map JS keys to record
|
|
13
|
+
# properties. When R8 renames the annotation class, records without
|
|
14
|
+
# `@OptimizedRecord` can fail to convert with a NullPointerException at that read.
|
|
15
|
+
-keep @interface expo.modules.kotlin.records.Field { *; }
|
|
16
|
+
|
|
12
17
|
-keep class * extends expo.modules.kotlin.sharedobjects.SharedObject
|
|
13
18
|
|
|
14
19
|
-keep enum * implements expo.modules.kotlin.types.Enumerable {
|
|
@@ -48,3 +53,32 @@
|
|
|
48
53
|
-keep class * implements expo.modules.kotlin.services.Service {
|
|
49
54
|
<init>(...);
|
|
50
55
|
}
|
|
56
|
+
|
|
57
|
+
# Expo Modules v2: ExpoModulesV2Host loads the generated list and the modules by reflection.
|
|
58
|
+
-keep class expo.modules.ExpoModulesV2ModuleList { public <init>(); }
|
|
59
|
+
-keep class * extends io.github.expo.modules.v2.Module {
|
|
60
|
+
<init>();
|
|
61
|
+
static ** INSTANCE;
|
|
62
|
+
}
|
|
63
|
+
# The v2 C++ runtime reaches these through JNI, and the artifacts ship no consumer rules.
|
|
64
|
+
-keep class io.github.expo.kolibri.** { *; }
|
|
65
|
+
-keep class io.github.expo.modules.v2.** { *; }
|
|
66
|
+
# JNI calls exported members and generated trampolines by name.
|
|
67
|
+
# A record registers its codec from the static `recordCodec$ExpoModulesV2` field initializer.
|
|
68
|
+
-keepclassmembers class * {
|
|
69
|
+
@io.github.expo.modules.v2.JS *;
|
|
70
|
+
@io.github.expo.modules.v2.Constant *;
|
|
71
|
+
@io.github.expo.modules.v2.Event *;
|
|
72
|
+
*** *$ExpoModulesV2(...);
|
|
73
|
+
static ** *$ExpoModulesV2;
|
|
74
|
+
}
|
|
75
|
+
-keep class **$ExpoModulesV2 { <init>(); }
|
|
76
|
+
# Kotlin puts property annotations on a synthetic method, so the getters need a rule of their own.
|
|
77
|
+
-keepclassmembers class * extends io.github.expo.modules.v2.Module { public *; }
|
|
78
|
+
-keepclassmembers class * extends io.github.expo.modules.v2.SharedObject { public *; }
|
|
79
|
+
# EnumConverter reads an enum's only property field by reflection, and v2 enums have no marker type.
|
|
80
|
+
# Scope it to enums in the package (and subpackages) of a v2 module or shared object.
|
|
81
|
+
-if class **.* extends io.github.expo.modules.v2.Module
|
|
82
|
+
-keepclassmembers,allowobfuscation enum <1>.** { !static <fields>; }
|
|
83
|
+
-if class **.* extends io.github.expo.modules.v2.SharedObject
|
|
84
|
+
-keepclassmembers,allowobfuscation enum <1>.** { !static <fields>; }
|
|
@@ -20,9 +20,21 @@ class ExpoBridgeModule(
|
|
|
20
20
|
fun installModules(): Boolean {
|
|
21
21
|
// Bridgeless ReactHostImpl may have BridgelessReactContext ready but not ReactInstance.
|
|
22
22
|
// Try to busy wait until ReactInstance is available so we could get the javaScriptContextHolder.
|
|
23
|
-
tryWaitSync(waitMs = 100, retries = 10) {
|
|
23
|
+
val ready = tryWaitSync(waitMs = 100, retries = 10) {
|
|
24
24
|
reactApplicationContext.hasActiveReactInstance()
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
if (!ready) {
|
|
28
|
+
// Don't fall through silently: without an active ReactInstance, installJSIInterop()
|
|
29
|
+
// below installs nothing into the runtime and this method still returns true, so the
|
|
30
|
+
// first visible symptom is JS reading `globalThis.expo` as undefined ("Cannot read
|
|
31
|
+
// property 'EventEmitter' of undefined") - far from the cause.
|
|
32
|
+
logger.warn(
|
|
33
|
+
"hasActiveReactInstance() is still false after waiting; installing JSI interop anyway. " +
|
|
34
|
+
"globalThis.expo will most likely be missing in the JS runtime."
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
26
38
|
val kotlinInterop = nativeModulesProxy.get()?.kotlinInteropModuleRegistry
|
|
27
39
|
?: throw IllegalStateException("Couldn't find KotlinInteropModuleRegistry")
|
|
28
40
|
|
|
@@ -30,12 +42,16 @@ class ExpoBridgeModule(
|
|
|
30
42
|
return true
|
|
31
43
|
}
|
|
32
44
|
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Returns whether the predicate became true within the given budget.
|
|
47
|
+
*/
|
|
48
|
+
private fun tryWaitSync(waitMs: Long, retries: Int, predicate: () -> Boolean): Boolean {
|
|
49
|
+
repeat(retries) {
|
|
35
50
|
if (predicate()) {
|
|
36
|
-
return
|
|
51
|
+
return true
|
|
37
52
|
}
|
|
38
53
|
Thread.sleep(waitMs)
|
|
39
54
|
}
|
|
55
|
+
return predicate()
|
|
40
56
|
}
|
|
41
57
|
}
|
package/android/src/main/java/expo/modules/kotlin/defaultmodules/NativeModulesProxyModule.kt
CHANGED
|
@@ -9,13 +9,17 @@ import expo.modules.kotlin.toBridgePromise
|
|
|
9
9
|
|
|
10
10
|
internal const val NativeModulesProxyModuleName = "NativeModulesProxy"
|
|
11
11
|
|
|
12
|
+
private val legacyConstantKeys = listOf("modulesConstants", "exportedMethods", "viewManagersMetadata")
|
|
13
|
+
|
|
12
14
|
class NativeModulesProxyModule : Module() {
|
|
13
15
|
override fun definition() = ModuleDefinition {
|
|
14
16
|
Name(NativeModulesProxyModuleName)
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
// The legacy proxy isn't attached yet when this definition is built, so read it lazily.
|
|
19
|
+
// Reading its constants is also what emits `OnCreate` to all modules.
|
|
20
|
+
legacyConstantKeys.forEach { key ->
|
|
21
|
+
Constant(key) {
|
|
22
|
+
appContext.legacyModulesProxyHolder?.get()?.constants?.get(key)
|
|
19
23
|
}
|
|
20
24
|
}
|
|
21
25
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
package expo.modules.kotlin.views
|
|
2
2
|
|
|
3
3
|
import android.view.ViewTreeObserver
|
|
4
|
+
import androidx.annotation.UiThread
|
|
4
5
|
import expo.modules.kotlin.jni.fabric.NativeStatePropsGetter
|
|
6
|
+
import kotlinx.coroutines.launch
|
|
5
7
|
import java.lang.ref.WeakReference
|
|
6
8
|
|
|
7
9
|
class ShadowNodeProxy(expoView: ExpoView) {
|
|
@@ -10,18 +12,24 @@ class ShadowNodeProxy(expoView: ExpoView) {
|
|
|
10
12
|
|
|
11
13
|
private var pendingFlush: ((stateWrapper: Any) -> Unit)? = null
|
|
12
14
|
private var preDrawListener: ViewTreeObserver.OnPreDrawListener? = null
|
|
13
|
-
private
|
|
15
|
+
private var flushPosted = false
|
|
16
|
+
private val flushRunnable = Runnable {
|
|
17
|
+
flushPosted = false
|
|
18
|
+
drainPendingFlush()
|
|
19
|
+
}
|
|
14
20
|
|
|
15
21
|
// Schedule in predraw listener to avoid early return in re-entrancy
|
|
16
22
|
// We have a proper fix [here](https://github.com/facebook/react-native/pull/56311)
|
|
17
23
|
// but it needs to be merged in RN
|
|
18
24
|
// TODO: Remove the workaround when RN PR gets merged.
|
|
25
|
+
@UiThread
|
|
19
26
|
fun setViewSize(width: Double, height: Double) {
|
|
20
27
|
scheduleFlush { stateWrapper ->
|
|
21
28
|
stateUpdater.updateViewSizeImmediate(stateWrapper, width, height)
|
|
22
29
|
}
|
|
23
30
|
}
|
|
24
31
|
|
|
32
|
+
@UiThread
|
|
25
33
|
fun setStyleSize(width: Double?, height: Double?) {
|
|
26
34
|
scheduleFlush { stateWrapper ->
|
|
27
35
|
stateUpdater.updateStyleSizeImmediate(stateWrapper, width ?: Double.NaN, height ?: Double.NaN)
|
|
@@ -68,8 +76,18 @@ class ShadowNodeProxy(expoView: ExpoView) {
|
|
|
68
76
|
|
|
69
77
|
// Predraw listener do not get called for each keyboard transition event so we add a fallback flush to be called here
|
|
70
78
|
// https://github.com/expo/expo/issues/47778
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
// Async and posted once, so it still runs during animations.
|
|
80
|
+
// `Dispatchers.Main` posts async messages, which skip the traversal sync barriers.
|
|
81
|
+
// https://github.com/expo/expo/issues/51034
|
|
82
|
+
if (!flushPosted) {
|
|
83
|
+
flushPosted = true
|
|
84
|
+
if (view.isAttachedToWindow) {
|
|
85
|
+
view.appContext.mainQueue.launch { flushRunnable.run() }
|
|
86
|
+
} else {
|
|
87
|
+
// `view.post` keeps the runnable until the view attaches.
|
|
88
|
+
view.post(flushRunnable)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
73
91
|
}
|
|
74
92
|
|
|
75
93
|
private fun drainPendingFlush() {
|
|
@@ -70,6 +70,11 @@ public final class ClassDefinition: ObjectDefinition {
|
|
|
70
70
|
if let sharedObject = result as? SharedObject {
|
|
71
71
|
appContext.sharedObjectRegistry.add(native: sharedObject, javaScript: this.getObject())
|
|
72
72
|
}
|
|
73
|
+
} else if sharedObjectType != nil {
|
|
74
|
+
// Nothing built a native instance, so the object would reach JavaScript with no backing
|
|
75
|
+
// state and fail at its first member access. Classes whose inputs only the native side can
|
|
76
|
+
// supply land here: they need a `@JS init` or a DSL `Constructor` to be constructible.
|
|
77
|
+
throw Exceptions.ConstructorUnavailable(name)
|
|
73
78
|
}
|
|
74
79
|
return this
|
|
75
80
|
}
|
|
@@ -99,6 +99,15 @@ public struct Exceptions {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/// An exception thrown when JavaScript calls `new` on a class whose native instance only the
|
|
103
|
+
/// native side can build. The class exposes no `@JS init` and no DSL `Constructor`, so there is
|
|
104
|
+
/// nothing to construct it with.
|
|
105
|
+
public final class ConstructorUnavailable: GenericException<String> {
|
|
106
|
+
override public var reason: String {
|
|
107
|
+
"'\(param)' cannot be constructed from JavaScript because its native instance is created by the module that owns it. Get an instance from that module's API instead of calling `new \(param)()`."
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
102
111
|
/**
|
|
103
112
|
An exception to throw when there is no module implementing the `EXPermissionsInterface` interface.
|
|
104
113
|
- Note: This should never happen since the module is a part of `expo-modules-core`, but for compatibility reasons
|
|
@@ -63,6 +63,19 @@ open class Exception: CodedError, ChainableException, CustomStringConvertible, C
|
|
|
63
63
|
let debugDescription = "\(name): \(reason) (at \(origin.file):\(origin.line))"
|
|
64
64
|
return concatDescription(debugDescription, withCause: cause, debug: true)
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
// MARK: - JavaScriptThrowable
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
The message of the JavaScript error this exception is converted to. Defaults to `description`
|
|
71
|
+
(the reason and its cause chain), matching Android and what JavaScript received before the
|
|
72
|
+
JSI rewrite, instead of the protocol's default `debugDescription`, which also leaks the type
|
|
73
|
+
name and the native `file:line`. It is declared on the class, rather than inherited from the
|
|
74
|
+
protocol extension, so that subclasses can override it.
|
|
75
|
+
*/
|
|
76
|
+
open var message: String {
|
|
77
|
+
description
|
|
78
|
+
}
|
|
66
79
|
}
|
|
67
80
|
|
|
68
81
|
/**
|
|
@@ -83,8 +83,7 @@ internal final class ReadOnlyExpoModulesPropertyException: GenericException<Stri
|
|
|
83
83
|
+ "Define or override behavior inside the native module instead."
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
var message: String { reason }
|
|
86
|
+
// `Exception.message` is the `description`, which is just `reason` here (no cause chain).
|
|
87
|
+
// Override it explicitly so the JS-facing error stays the bare `reason`.
|
|
88
|
+
override var message: String { reason }
|
|
90
89
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-core",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.15",
|
|
4
4
|
"description": "The core of Expo Modules architecture",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expo",
|
|
@@ -64,16 +64,16 @@
|
|
|
64
64
|
"./package.json": "./package.json"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"expo-modules-jsi": "~58.0.
|
|
67
|
+
"expo-modules-jsi": "~58.0.10",
|
|
68
68
|
"expo-modules-macros": "0.15.0",
|
|
69
69
|
"invariant": "^2.2.4"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
+
"@expo/internal-scripts": "58.0.1",
|
|
72
73
|
"@testing-library/react-native": "^14.0.1",
|
|
73
74
|
"@types/invariant": "^2.2.33",
|
|
74
75
|
"@types/react": "~19.3.0",
|
|
75
76
|
"@types/react-dom": "^19.1.7",
|
|
76
|
-
"expo-module-scripts": "56.0.8",
|
|
77
77
|
"react-dom": "19.3.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|