Skip to content

Commit c94b658

Browse files
authored
fix(react-native-host): detect when bridgeless mode is required (#3753)
1 parent c1f7f94 commit c94b658

File tree

6 files changed

+24
-5
lines changed

6 files changed

+24
-5
lines changed

.changeset/metal-trees-dress.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rnx-kit/react-native-host": patch
3+
---
4+
5+
Detect when bridgeless mode is required

packages/react-native-host/cocoa/RNXBridgelessHeaders.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#if USE_BRIDGELESS
2-
3-
// clang-format off
41
#import "RNXFeatureMacros.h"
5-
// clang-format on
2+
3+
#if USE_BRIDGELESS
64

75
#import <React/RCTSurfacePresenterBridgeAdapter.h>
86
#import <ReactCommon/RCTHost+Internal.h>

packages/react-native-host/cocoa/RNXFabricAdapter.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#import "RNXFabricAdapter.h"
22

3+
#import "RNXFeatureMacros.h"
4+
35
#if USE_FABRIC && !USE_BRIDGELESS
46
#include "FollyConfig.h"
57
#pragma clang diagnostic push

packages/react-native-host/cocoa/RNXFeatureMacros.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1+
// Force enable Hermes if JSC is not available
12
#if !__has_include(<ReactCommon/RCTJscInstance.h>)
23
#ifdef USE_HERMES
34
#undef USE_HERMES
4-
#endif // !USE_HERMES
5+
#endif // USE_HERMES
56
#define USE_HERMES 1
67
#endif // !__has_include(<ReactCommon/RCTJscInstance.h>)
78

9+
// Force enable bridgeless mode if New Architecture is enabled and requires it
10+
#if USE_FABRIC && !__has_include(<react/config/ReactNativeConfig.h>)
11+
#ifdef USE_BRIDGELESS
12+
#undef USE_BRIDGELESS
13+
#endif // USE_BRIDGELESS
14+
#define USE_BRIDGELESS 1
15+
#endif // USE_FABRIC && !__has_include(<react/config/ReactNativeConfig.h>)
16+
817
#if USE_BRIDGELESS
918

1019
#if __has_include(<react/config/ReactNativeConfig.h>)

packages/react-native-host/cocoa/ReactNativeHost+View.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
// clang-format off
12
#import "ReactNativeHost+Private.h"
3+
// clang-format on
4+
5+
#import "RNXFeatureMacros.h"
26

37
#ifdef USE_FABRIC
48
#if __has_include(<React/RCTFabricSurfaceHostingProxyRootView.h>)

packages/react-native-host/cocoa/ReactNativeHost.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#import "RNXBridgelessHeaders.h"
1414
#import "RNXFabricAdapter.h"
15+
#import "RNXFeatureMacros.h"
1516
#import "RNXHostConfig.h"
1617
#import "RNXHostReleaser.h"
1718
#import "RNXTurboModuleAdapter.h"

0 commit comments

Comments
 (0)