Skip to content

Commit

Permalink
clean up contextContainer->insert("ReactNativeConfig") from oss
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Internal]

we don't need any of these now since no one is calling `contextContainer_->at<std::shared_ptr>("ReactNativeConfig")` anymore

Differential Revision: D65304976
  • Loading branch information
philIip authored and facebook-github-bot committed Oct 31, 2024
1 parent ecd138e commit 0f030af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
20 changes: 2 additions & 18 deletions packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#import <React/RCTFabricSurface.h>
#import <React/RCTSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
#import <ReactCommon/RCTContextContainerHandling.h>
#if USE_HERMES
#import <ReactCommon/RCTHermesInstance.h>
#else
Expand All @@ -35,7 +34,6 @@
#import <ReactCommon/RCTHost+Internal.h>
#import <ReactCommon/RCTHost.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <react/config/ReactNativeConfig.h>
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
#import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
#import <react/runtime/JSRuntimeFactory.h>
Expand Down Expand Up @@ -99,13 +97,8 @@ - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock

@end

@interface RCTRootViewFactory () <RCTContextContainerHandling> {
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
facebook::react::ContextContainer::Shared _contextContainer;
}
@end

@interface RCTRootViewFactory () <RCTCxxBridgeDelegate> {
facebook::react::ContextContainer::Shared _contextContainer;
std::shared_ptr<facebook::react::RuntimeScheduler> _runtimeScheduler;
}
@end
Expand All @@ -124,8 +117,6 @@ - (instancetype)initWithTurboModuleDelegate:(id<RCTTurboModuleManagerDelegate>)t
_configuration = configuration;
_hostDelegate = hostdelegate;
_contextContainer = std::make_shared<const facebook::react::ContextContainer>();
_reactNativeConfig = std::make_shared<const facebook::react::EmptyReactNativeConfig>();
_contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
_turboModuleManagerDelegate = turboModuleManagerDelegate;
}
return self;
Expand Down Expand Up @@ -281,26 +272,19 @@ - (RCTHost *)createReactHost:(NSDictionary *)launchOptions
[reactHost setBundleURLProvider:^NSURL *() {
return [weakSelf bundleURL];
}];
[reactHost setContextContainerHandler:self];
[reactHost start];
return reactHost;
}

- (std::shared_ptr<facebook::react::JSRuntimeFactory>)createJSRuntimeFactory
{
#if USE_HERMES
return std::make_shared<facebook::react::RCTHermesInstance>(
_reactNativeConfig, nullptr, /* allocInOldGenBeforeTTI */ false);
return std::make_shared<facebook::react::RCTHermesInstance>(nullptr, nullptr, /* allocInOldGenBeforeTTI */ false);
#else
return std::make_shared<facebook::react::RCTJscInstance>();
#endif
}

- (void)didCreateContextContainer:(std::shared_ptr<facebook::react::ContextContainer>)contextContainer
{
contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
}

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
{
if (_configuration.extraModulesForBridge != nil) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ void FabricUIManagerBinding::installFabricUIManager(
globalJavaUiManager);
};

contextContainer->insert("ReactNativeConfig", config);
contextContainer->insert("FabricUIManager", globalJavaUiManager);

// Keep reference to config object and cache some feature flags here
Expand Down

0 comments on commit 0f030af

Please sign in to comment.