Skip to content

Commit fb6032c

Browse files
committed
fix: patch RCTTurboModule.mm for iOS 26 PAC crash (react-native#56265)
Void method invocations in ObjCTurboModule accessed the Hermes JS runtime from the native dispatch queue thread. On iOS 26 physical devices with arm64e PAC enforcement this caused an immediate SIGABRT during startup (ErrorRecovery.tryRelaunchFromCache → crash). Applied upstream fix from facebook/react-native#56265 via patch-package: replace convertNSExceptionToJSError with @throw to re-throw natively.
1 parent 615f439 commit fb6032c

3 files changed

Lines changed: 190 additions & 2 deletions

File tree

package-lock.json

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

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"lint:fix": "eslint . --ext .ts,.tsx,.js,.jsx --fix",
1818
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
1919
"format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"",
20+
"postinstall": "patch-package",
2021
"prepare": "husky",
2122
"deploy:edge-functions": "npx supabase functions deploy gemini-handler && npx supabase functions deploy get-multiple-images",
2223
"deploy:constants": "echo '🚀 Deploying Edge Functions due to constants change...' && npm run deploy:edge-functions && echo '✅ Edge Functions updated with new constants!'",
@@ -108,6 +109,7 @@
108109
"jest": "^29.2.1",
109110
"jest-expo": "~55.0.13",
110111
"lint-staged": "^15.5.2",
112+
"patch-package": "^8.0.1",
111113
"prettier": "^3.6.2",
112114
"react-test-renderer": "19.2.0",
113115
"typescript": "~5.9.2"

patches/react-native+0.83.4.patch

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm b/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm
2+
index 6646570..4217c7a 100644
3+
--- a/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm
4+
+++ b/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm
5+
@@ -470,7 +470,11 @@ void ObjCTurboModule::performVoidMethodInvocation(
6+
@try {
7+
[inv invokeWithTarget:strongModule];
8+
} @catch (NSException *exception) {
9+
- throw convertNSExceptionToJSError(runtime, exception, std::string{moduleName}, methodNameStr);
10+
+ // Void methods are always async — re-throw natively instead of
11+
+ // converting to JSError (which would access the JS runtime from
12+
+ // the wrong thread, causing PAC crashes on iOS 26+).
13+
+ // See https://github.com/facebook/react-native/pull/56265
14+
+ @throw exception;
15+
} @finally {
16+
[retainedObjectsForInvocation removeAllObjects];
17+
}

0 commit comments

Comments
 (0)