Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/loud-coins-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rnx-kit/react-native-host": patch
---

Backport fix for shadow node state not updating (see
https://github.com/facebook/react-native/issues/49694)
36 changes: 22 additions & 14 deletions packages/react-native-host/cocoa/RNXBridgelessHeaders.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#if USE_BRIDGELESS

// clang-format off
#import "RNXFeatureMacros.h"
// clang-format on

#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTHost+Internal.h>
#import <ReactCommon/RCTHost.h>
Expand All @@ -10,22 +14,19 @@
#import <ReactCommon/RCTJscInstance.h>
#endif // USE_HERMES

#if __has_include(<react/config/ReactNativeConfig.h>)
#ifdef USE_REACT_NATIVE_CONFIG
#import <react/config/ReactNativeConfig.h>
#define USE_REACT_NATIVE_CONFIG
#endif // __has_include(<react/config/ReactNativeConfig.h>)
#endif // USE_REACT_NATIVE_CONFIG

#if __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
#ifdef USE_FEATURE_FLAGS
#import <react/featureflags/ReactNativeFeatureFlags.h>
#import <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
#define USE_FEATURE_FLAGS
#endif // __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
#endif // USE_FEATURE_FLAGS

#if __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
#define USE_CODEGEN_PROVIDER 1
#ifdef USE_CODEGEN_PROVIDER
#import <React/RCTComponentViewFactory.h>
#import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
#endif // __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
#endif // USE_CODEGEN_PROVIDER

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

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

// https://github.com/facebook/react-native/blob/0.74-stable/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm#L272-L286
class RNXBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults
Expand All @@ -83,12 +81,22 @@ class RNXBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlag
{
return true;
}
#if !__has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>) && !__has_include(<React_RCTAppDelegate/RCTReactNativeFactory.h>) // 0.77
#if USE_VIEW_COMMAND_RACE_FIX // 0.77
bool enableFixForViewCommandRace() override
{
return true;
}
#endif // 0.77
#endif // USE_VIEW_COMMAND_RACE_FIX
#if USE_UPDATE_RUNTIME_SHADOW_NODE_REFS_ON_COMMIT // >= 0.79
bool updateRuntimeShadowNodeReferencesOnCommit() override
{
return true;
}
bool useShadowNodeStateOnClone() override
{
return true;
}
#endif // USE_UPDATE_RUNTIME_SHADOW_NODE_REFS_ON_COMMIT
#else // < 0.77
bool useModernRuntimeScheduler() override
{
Expand Down
31 changes: 31 additions & 0 deletions packages/react-native-host/cocoa/RNXFeatureMacros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#if USE_BRIDGELESS

#if __has_include(<react/config/ReactNativeConfig.h>)
#define USE_REACT_NATIVE_CONFIG 1
#endif // __has_include(<react/config/ReactNativeConfig.h>)

#if __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
#define USE_FEATURE_FLAGS 1
#endif // __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)

#if __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
#define USE_CODEGEN_PROVIDER 1
#endif // __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)

#ifdef USE_FEATURE_FLAGS

#if __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>) || __has_include(<React_RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
#define USE_UNIFIED_FEATURE_FLAGS 1
#endif // __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>)

#if !__has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>) && !__has_include(<React_RCTAppDelegate/RCTReactNativeFactory.h>)
#define USE_VIEW_COMMAND_RACE_FIX 1
#endif // !__has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>)

#if __has_include(<React-RCTAppDelegate/RCTJSRuntimeConfiguratorProtocol.h>) || __has_include(<React_RCTAppDelegate/RCTJSRuntimeConfiguratorProtocol.h>)
#define USE_UPDATE_RUNTIME_SHADOW_NODE_REFS_ON_COMMIT 1
#endif // __has_include(<React-RCTAppDelegate/RCTJSRuntimeConfiguratorProtocol.h>)

#endif // USE_FEATURE_FLAGS

#endif // USE_BRIDGELESS
Loading