Skip to content

Commit c2e4303

Browse files
authored
fix(react-native-host): backport fix for Reanimated issue (#3602)
1 parent f53edc0 commit c2e4303

File tree

3 files changed

+59
-14
lines changed

3 files changed

+59
-14
lines changed

.changeset/loud-coins-deny.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@rnx-kit/react-native-host": patch
3+
---
4+
5+
Backport fix for shadow node state not updating (see
6+
https://github.com/facebook/react-native/issues/49694)

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

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#if USE_BRIDGELESS
22

3+
// clang-format off
4+
#import "RNXFeatureMacros.h"
5+
// clang-format on
6+
37
#import <React/RCTSurfacePresenterBridgeAdapter.h>
48
#import <ReactCommon/RCTHost+Internal.h>
59
#import <ReactCommon/RCTHost.h>
@@ -10,22 +14,19 @@
1014
#import <ReactCommon/RCTJscInstance.h>
1115
#endif // USE_HERMES
1216

13-
#if __has_include(<react/config/ReactNativeConfig.h>)
17+
#ifdef USE_REACT_NATIVE_CONFIG
1418
#import <react/config/ReactNativeConfig.h>
15-
#define USE_REACT_NATIVE_CONFIG
16-
#endif // __has_include(<react/config/ReactNativeConfig.h>)
19+
#endif // USE_REACT_NATIVE_CONFIG
1720

18-
#if __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
21+
#ifdef USE_FEATURE_FLAGS
1922
#import <react/featureflags/ReactNativeFeatureFlags.h>
2023
#import <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
21-
#define USE_FEATURE_FLAGS
22-
#endif // __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
24+
#endif // USE_FEATURE_FLAGS
2325

24-
#if __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
25-
#define USE_CODEGEN_PROVIDER 1
26+
#ifdef USE_CODEGEN_PROVIDER
2627
#import <React/RCTComponentViewFactory.h>
2728
#import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
28-
#endif // __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
29+
#endif // USE_CODEGEN_PROVIDER
2930

3031
#if __has_include(<react/runtime/JSEngineInstance.h>)
3132
using SharedJSRuntimeFactory = std::shared_ptr<facebook::react::JSEngineInstance>;
@@ -58,9 +59,6 @@ using SharedJSRuntimeFactory = std::shared_ptr<facebook::react::JSRuntimeFactory
5859
@end
5960

6061
#ifdef USE_FEATURE_FLAGS
61-
#if __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>) || __has_include(<React_RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
62-
#define USE_UNIFIED_FEATURE_FLAGS 1
63-
#endif // __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
6462

6563
// https://github.com/facebook/react-native/blob/0.74-stable/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm#L272-L286
6664
class RNXBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults
@@ -83,12 +81,22 @@ class RNXBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlag
8381
{
8482
return true;
8583
}
86-
#if !__has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>) && !__has_include(<React_RCTAppDelegate/RCTReactNativeFactory.h>) // 0.77
84+
#if USE_VIEW_COMMAND_RACE_FIX // 0.77
8785
bool enableFixForViewCommandRace() override
8886
{
8987
return true;
9088
}
91-
#endif // 0.77
89+
#endif // USE_VIEW_COMMAND_RACE_FIX
90+
#if USE_UPDATE_RUNTIME_SHADOW_NODE_REFS_ON_COMMIT // >= 0.79
91+
bool updateRuntimeShadowNodeReferencesOnCommit() override
92+
{
93+
return true;
94+
}
95+
bool useShadowNodeStateOnClone() override
96+
{
97+
return true;
98+
}
99+
#endif // USE_UPDATE_RUNTIME_SHADOW_NODE_REFS_ON_COMMIT
92100
#else // < 0.77
93101
bool useModernRuntimeScheduler() override
94102
{
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#if USE_BRIDGELESS
2+
3+
#if __has_include(<react/config/ReactNativeConfig.h>)
4+
#define USE_REACT_NATIVE_CONFIG 1
5+
#endif // __has_include(<react/config/ReactNativeConfig.h>)
6+
7+
#if __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
8+
#define USE_FEATURE_FLAGS 1
9+
#endif // __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
10+
11+
#if __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
12+
#define USE_CODEGEN_PROVIDER 1
13+
#endif // __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
14+
15+
#ifdef USE_FEATURE_FLAGS
16+
17+
#if __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>) || __has_include(<React_RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
18+
#define USE_UNIFIED_FEATURE_FLAGS 1
19+
#endif // __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
20+
21+
#if !__has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>) && !__has_include(<React_RCTAppDelegate/RCTReactNativeFactory.h>)
22+
#define USE_VIEW_COMMAND_RACE_FIX 1
23+
#endif // !__has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>)
24+
25+
#if __has_include(<React-RCTAppDelegate/RCTJSRuntimeConfiguratorProtocol.h>) || __has_include(<React_RCTAppDelegate/RCTJSRuntimeConfiguratorProtocol.h>)
26+
#define USE_UPDATE_RUNTIME_SHADOW_NODE_REFS_ON_COMMIT 1
27+
#endif // __has_include(<React-RCTAppDelegate/RCTJSRuntimeConfiguratorProtocol.h>)
28+
29+
#endif // USE_FEATURE_FLAGS
30+
31+
#endif // USE_BRIDGELESS

0 commit comments

Comments
 (0)