Skip to content

Commit af6d363

Browse files
voida6claude
andcommitted
fix(mobile): the app builds and launches again after the Expo update
#20067 left the mobile app unable to build for Android and crashing at launch: - expo-widgets 58.0.18 imports io.github.jakex7.peek.* but depends on io.github.expo.peek 0.3.2, so the Android build fails. - Its CustomNotification shared object has no constructor, which expo-modules-core rejects while registering WidgetsModule at launch. - The @react-navigation/core override still pinned 7.21.13, while @react-navigation/native 7.5.1 requires ^7.24.0; native-stack 7.21.0 calls the newer render() from useNavigationBuilder and throws. Patch the imports and add a throwing constructor in expo-widgets, and move the core override to 7.24.0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent e74f477 commit af6d363

3 files changed

Lines changed: 77 additions & 51 deletions

File tree

‎patches/[email protected]‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,64 @@
1+
diff --git a/android/src/main/java/expo/modules/widgets/WidgetsModule.kt b/android/src/main/java/expo/modules/widgets/WidgetsModule.kt
2+
index f947f46..d290055 100644
3+
--- a/android/src/main/java/expo/modules/widgets/WidgetsModule.kt
4+
+++ b/android/src/main/java/expo/modules/widgets/WidgetsModule.kt
5+
@@ -84,6 +84,11 @@ class WidgetsModule : Module() {
6+
}
7+
8+
Class("CustomNotification", CustomNotification::class) {
9+
+ // A SharedObject class without a constructor fails module registration at launch.
10+
+ Constructor { ->
11+
+ throw UnsupportedOperationException("CustomNotification instances come from CustomNotificationFactory")
12+
+ }
13+
+
14+
Function("getId") { notification: CustomNotification ->
15+
notification.id
16+
}
17+
diff --git a/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationBuilder.kt b/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationBuilder.kt
18+
index 07eca41..82cabea 100644
19+
--- a/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationBuilder.kt
20+
+++ b/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationBuilder.kt
21+
@@ -14,8 +14,8 @@ import android.os.Bundle
22+
import androidx.core.app.NotificationCompat
23+
import androidx.core.app.NotificationManagerCompat
24+
import expo.modules.widgets.R
25+
-import io.github.jakex7.peek.notification.PeekNotificationViews
26+
-import io.github.jakex7.peek.notification.setPeekContent
27+
+import io.github.expo.peek.notification.PeekNotificationViews
28+
+import io.github.expo.peek.notification.setPeekContent
29+
30+
internal object CustomNotificationBuilder {
31+
private const val DEFAULT_CHANNEL_ID = "expo_widgets_notifications"
32+
diff --git a/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationRenderer.kt b/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationRenderer.kt
33+
index 446a39e..e90b09a 100644
34+
--- a/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationRenderer.kt
35+
+++ b/android/src/main/java/expo/modules/widgets/notifications/CustomNotificationRenderer.kt
36+
@@ -8,9 +8,9 @@ import expo.modules.widgets.WidgetsStorage
37+
import expo.modules.widgets.evaluateLayout
38+
import expo.modules.widgets.getWidgetEnvironment
39+
import expo.modules.widgets.toPeekRoot
40+
-import io.github.jakex7.peek.emittables.peekEmittableNotificationViews
41+
-import io.github.jakex7.peek.notification.PeekNotificationSizes
42+
-import io.github.jakex7.peek.notification.PeekNotificationViews
43+
+import io.github.expo.peek.emittables.peekEmittableNotificationViews
44+
+import io.github.expo.peek.notification.PeekNotificationSizes
45+
+import io.github.expo.peek.notification.PeekNotificationViews
46+
47+
internal object CustomNotificationRenderer {
48+
suspend fun render(context: Context, state: CustomNotificationState): PeekNotificationViews {
49+
diff --git a/android/src/main/java/expo/modules/widgets/notifications/CustomNotifications.kt b/android/src/main/java/expo/modules/widgets/notifications/CustomNotifications.kt
50+
index a7b372e..dd001ee 100644
51+
--- a/android/src/main/java/expo/modules/widgets/notifications/CustomNotifications.kt
52+
+++ b/android/src/main/java/expo/modules/widgets/notifications/CustomNotifications.kt
53+
@@ -3,7 +3,7 @@ package expo.modules.widgets.notifications
54+
import android.annotation.SuppressLint
55+
import android.content.Context
56+
import androidx.core.app.NotificationManagerCompat
57+
-import io.github.jakex7.peek.notification.PeekNotificationViews
58+
+import io.github.expo.peek.notification.PeekNotificationViews
59+
import kotlinx.coroutines.CancellationException
60+
import kotlinx.coroutines.Job
61+
import kotlinx.coroutines.coroutineScope
162
diff --git a/build/Widgets.types.d.ts b/build/Widgets.types.d.ts
263
index 4c474bb..b0173df 100644
364
--- a/build/Widgets.types.d.ts

‎pnpm-lock.yaml‎

Lines changed: 13 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ overrides:
215215
# Keep jsdom's optional peer consistent so Vite+ has one test-runner instance.
216216
"@exodus/bytes>@noble/hashes": "1.8.0"
217217
# Earlier React Navigation declarations create a circular type alias in TypeScript 7.
218-
"@react-navigation/core": 7.21.13
218+
# Move this with @react-navigation/native: an older core than it requires crashes
219+
# every native stack at launch.
220+
"@react-navigation/core": 7.24.0
219221
# The dbus-next patch drops usocket from the package, but pnpm resolves from the
220222
# registry manifest, so the edge has to be cut here as well.
221223
"dbus-next>usocket": "-"

0 commit comments

Comments
 (0)