Skip to content

Commit 5cb45bc

Browse files
committed
chore: update expo-updates to use a patch for bridgeless crash fix
1 parent 4a24ae3 commit 5cb45bc

4 files changed

Lines changed: 83 additions & 2 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
diff --git a/android/src/main/java/expo/modules/updates/errorrecovery/ErrorRecovery.kt b/android/src/main/java/expo/modules/updates/errorrecovery/ErrorRecovery.kt
2+
index c216e1cfaff3b6c0bcae4f0fd68f02cadac7aabd..702735099c49f811caae7f71ce9291f9f6c7104a 100644
3+
--- a/android/src/main/java/expo/modules/updates/errorrecovery/ErrorRecovery.kt
4+
+++ b/android/src/main/java/expo/modules/updates/errorrecovery/ErrorRecovery.kt
5+
@@ -29,6 +29,7 @@ class ErrorRecovery(
6+
internal lateinit var handler: Handler
7+
8+
private var shouldHandleReactInstanceException = false
9+
+ private var previousBridgelessExceptionHandler: ((Exception) -> Unit)? = null
10+
11+
fun initialize(delegate: ErrorRecoveryDelegate) {
12+
if (!::handler.isInitialized) {
13+
@@ -49,6 +50,13 @@ class ErrorRecovery(
14+
internal fun onReactInstanceException(exception: Exception) {
15+
if (shouldHandleReactInstanceException) {
16+
handleException(exception)
17+
+ } else if (previousBridgelessExceptionHandler != null) {
18+
+ // PATCHED: Instead of silently ignoring, pass to fallback handler
19+
+ try {
20+
+ previousBridgelessExceptionHandler?.invoke(exception)
21+
+ } catch (e: Exception) {
22+
+ logger.error("Error in bridgeless exception fallback handler", e, UpdatesErrorCode.Unknown)
23+
+ }
24+
}
25+
}
26+
27+
@@ -92,9 +100,16 @@ class ErrorRecovery(
28+
29+
private fun registerErrorHandler(devSupportManager: DevSupportManager) {
30+
shouldHandleReactInstanceException = true
31+
+ // PATCHED: Store the current default uncaught exception handler as fallback
32+
+ previousBridgelessExceptionHandler = { exception ->
33+
+ Thread.getDefaultUncaughtExceptionHandler()?.uncaughtException(Thread.currentThread(), exception)
34+
+ }
35+
}
36+
37+
private fun unregisterErrorHandler() {
38+
shouldHandleReactInstanceException = false
39+
+ // PATCHED: Do NOT clear previousBridgelessExceptionHandler
40+
+ // Keep it active so crashes after 10s are still passed to the fallback handler
41+
+ // instead of being silently ignored. This is the core fix for the Bridgeless crash issue.
42+
}
43+
}

HACKS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,13 @@ Another dependency in the Expo/react-native ecosystem has brought in com.caveroc
286286
#### When can we remove this:
287287

288288
When the upstream @d11/react-native-fast-image closes and releases this PR https://github.com/dream-horizon-org/react-native-fast-image/pull/354/changes
289+
290+
## patch for expo-updates
291+
292+
#### Explanation/Context:
293+
294+
Started seeing blank screens on android when app was crashing instead of regularly crashing the app after we enabled new architecture. This patch attempts to fix that.
295+
296+
#### When can we remove this:
297+
298+
When the upstream expo-updates repository fixes the issue and releases a new version that properly handles crashes on Android with the new architecture. https://github.com/expo/expo/issues/41543

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
"expo": "^55.0.0",
156156
"expo-build-properties": "55.0.13",
157157
"expo-navigation-bar": "55.0.12",
158-
"expo-updates": "55.0.21",
158+
"expo-updates": "patch:expo-updates@npm%3A55.0.21#~/.yarn/patches/expo-updates-npm-55.0.21-990b55bddd.patch",
159159
"formik": "2.2.9",
160160
"html-entities": "2.3.3",
161161
"jwt-decode": "4.0.0",

yarn.lock

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13477,7 +13477,7 @@ __metadata:
1347713477
expo-build-disk-cache: "patch:expo-build-disk-cache@npm%3A0.7.2#~/.yarn/patches/expo-build-disk-cache-npm-0.7.2-c51a562767.patch"
1347813478
expo-build-properties: "npm:55.0.13"
1347913479
expo-navigation-bar: "npm:55.0.12"
13480-
expo-updates: "npm:55.0.21"
13480+
expo-updates: "patch:expo-updates@npm%3A55.0.21#~/.yarn/patches/expo-updates-npm-55.0.21-990b55bddd.patch"
1348113481
formik: "npm:2.2.9"
1348213482
graphql: "npm:16.8.1"
1348313483
graphql-request: "npm:5.1.0"
@@ -15010,6 +15010,34 @@ __metadata:
1501015010
languageName: node
1501115011
linkType: hard
1501215012

15013+
"expo-updates@patch:expo-updates@npm%3A55.0.21#~/.yarn/patches/expo-updates-npm-55.0.21-990b55bddd.patch":
15014+
version: 55.0.21
15015+
resolution: "expo-updates@patch:expo-updates@npm%3A55.0.21#~/.yarn/patches/expo-updates-npm-55.0.21-990b55bddd.patch::version=55.0.21&hash=c07c93"
15016+
dependencies:
15017+
"@expo/code-signing-certificates": "npm:^0.0.6"
15018+
"@expo/plist": "npm:^0.5.2"
15019+
"@expo/spawn-async": "npm:^1.7.2"
15020+
arg: "npm:^4.1.0"
15021+
chalk: "npm:^4.1.2"
15022+
debug: "npm:^4.3.4"
15023+
expo-eas-client: "npm:~55.0.5"
15024+
expo-manifests: "npm:~55.0.16"
15025+
expo-structured-headers: "npm:~55.0.2"
15026+
expo-updates-interface: "npm:~55.1.6"
15027+
getenv: "npm:^2.0.0"
15028+
glob: "npm:^13.0.0"
15029+
ignore: "npm:^5.3.1"
15030+
resolve-from: "npm:^5.0.0"
15031+
peerDependencies:
15032+
expo: "*"
15033+
react: "*"
15034+
react-native: "*"
15035+
bin:
15036+
expo-updates: bin/cli.js
15037+
checksum: 10c0/37f5afe711978847308db050376a999680c4b2e6964407f83212ef958f6c61878a87af20ea0943e882a4a5d16ed75bb5d765f0dc7765f87cf6622552c2175952
15038+
languageName: node
15039+
linkType: hard
15040+
1501315041
"expo@npm:^55.0.0":
1501415042
version: 55.0.23
1501515043
resolution: "expo@npm:55.0.23"

0 commit comments

Comments
 (0)