Skip to content

Commit 64cd15c

Browse files
alwxantonis
andauthored
fix(newArch): fixes how the availability of Turbo Modules is being detected (#5064)
* fix(newArch): fixes how the availability of Turbo Modules is being detected * Changelog message and reference link --------- Co-authored-by: Antonis Lilis <[email protected]>
1 parent c567628 commit 64cd15c

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
- Support New Hermes Runtime Access Pattern ([#5051](https://github.com/getsentry/sentry-react-native/pull/5051))
1515
- Support Metro 0.83 ([#5035](https://github.com/getsentry/sentry-react-native/pull/5035))
1616

17+
### Fixes
18+
19+
- Correct detection of whether turbo modules are available ([#5064](https://github.com/getsentry/sentry-react-native/pull/5064))
20+
1721
### Dependencies
1822

1923
- Bump CLI from v2.50.2 to v2.51.1 ([#5053](https://github.com/getsentry/sentry-react-native/pull/5053), [#5058](https://github.com/getsentry/sentry-react-native/pull/5058))

packages/core/src/js/utils/environment.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export function isHermesEnabled(): boolean {
1111

1212
/** Checks if the React Native TurboModules are enabled */
1313
export function isTurboModuleEnabled(): boolean {
14-
return RN_GLOBAL_OBJ.__turboModuleProxy != null;
14+
// Reference: https://github.com/facebook/react-native/blob/641a79dc5137b69a3c0813413b9fb82d0b9df783/packages/react-native/src/private/featureflags/ReactNativeFeatureFlagsBase.js#L110
15+
return RN_GLOBAL_OBJ.RN$Bridgeless === true || RN_GLOBAL_OBJ.__turboModuleProxy != null;
1516
}
1617

1718
/** Checks if the React Native Fabric renderer is running */

packages/core/src/js/utils/worldwide.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface ReactNativeInternalGlobal extends InternalGlobal {
2020
};
2121
Promise: unknown;
2222
__turboModuleProxy: unknown;
23+
RN$Bridgeless: unknown;
2324
nativeFabricUIManager: unknown;
2425
ErrorUtils?: ErrorUtils;
2526
expo?: ExpoGlobalObject;

0 commit comments

Comments
 (0)