Skip to content

Commit c8032f2

Browse files
christophpurrermeta-codesync[bot]
authored andcommitted
Remove legacy architecture code guarded by RCT_REMOVE_LEGACY_ARCH
Summary: This removes old bridge-based architecture code that was conditionally compiled via the RCT_REMOVE_LEGACY_ARCH preprocessor flag. The #ifndef RCT_REMOVE_LEGACY_ARCH guards and the legacy code within them have been removed. Where #else branches existed (new architecture code paths), only the new architecture code is kept. Files deleted entirely (100% legacy content): - RCTImageViewManager.mm/h - RCTImageShadowView.mm/h - RCTImageView.mm/h - RCTInputAccessoryViewManager.mm - RCTSinglelineTextInputView.mm/h - RCTSinglelineTextInputViewManager.mm/h - RCTBaseTextShadowView.h Files modified (legacy blocks removed): - RCTReactNativeFactory.mm - removed 5 legacy blocks - RCTAppSetupUtils.mm - removed 2 legacy blocks (functions now return nullptr) Differential Revision: D104495793
1 parent f363f6b commit c8032f2

151 files changed

Lines changed: 9 additions & 16817 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,4 @@ - (RCTRootViewFactory *)rootViewFactory
6767
return self.reactNativeFactory.rootViewFactory;
6868
}
6969

70-
#if !defined(RCT_REMOVE_LEGACY_ARCH)
71-
- (RCTBridge *)bridge
72-
{
73-
return self.rootViewFactory.bridge;
74-
}
75-
76-
- (RCTSurfacePresenterBridgeAdapter *)bridgeAdapter
77-
{
78-
return self.rootViewFactory.bridgeAdapter;
79-
}
80-
81-
- (void)setBridge:(RCTBridge *)bridge
82-
{
83-
self.reactNativeFactory.rootViewFactory.bridge = bridge;
84-
}
85-
86-
- (void)setBridgeAdapter:(RCTSurfacePresenterBridgeAdapter *)bridgeAdapter
87-
{
88-
self.reactNativeFactory.rootViewFactory.bridgeAdapter = bridgeAdapter;
89-
}
90-
#endif
91-
9270
@end

packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -120,60 +120,12 @@ void RCTAppSetupPrepareApp(UIApplication *application, BOOL turboModuleEnabled)
120120
RCTTurboModuleManager *turboModuleManager,
121121
const std::shared_ptr<facebook::react::RuntimeScheduler> &runtimeScheduler)
122122
{
123-
#ifndef RCT_REMOVE_LEGACY_ARCH
124-
// Necessary to allow NativeModules to lookup TurboModules
125-
[bridge setRCTTurboModuleRegistry:turboModuleManager];
126-
127-
#if RCT_DEV
128-
/**
129-
* Instantiating DevMenu has the side-effect of registering
130-
* shortcuts for CMD + d, CMD + i, and CMD + n via RCTDevMenu.
131-
* Therefore, when TurboModules are enabled, we must manually create this
132-
* NativeModule.
133-
*/
134-
[turboModuleManager moduleForName:"RCTDevMenu"];
135-
#endif // end RCT_DEV
136-
137-
auto runtimeInstallerLambda = [turboModuleManager, bridge, runtimeScheduler](facebook::jsi::Runtime &runtime) {
138-
if (!bridge || !turboModuleManager) {
139-
return;
140-
}
141-
if (runtimeScheduler) {
142-
facebook::react::RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime, runtimeScheduler);
143-
}
144-
[turboModuleManager installJSBindings:runtime];
145-
};
146-
#if USE_THIRD_PARTY_JSC != 1
147-
return std::make_unique<facebook::react::HermesExecutorFactory>(
148-
facebook::react::RCTJSIExecutorRuntimeInstaller(runtimeInstallerLambda));
149-
#endif
150-
#else
151-
// This method should not be invoked in the New Arch. So when Legacy Arch is removed, we can
152-
// safly return a nullptr.
153123
return nullptr;
154-
#endif
155124
}
156125

157126
std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupJsExecutorFactoryForOldArch(
158127
RCTBridge *bridge,
159128
const std::shared_ptr<facebook::react::RuntimeScheduler> &runtimeScheduler)
160129
{
161-
#ifndef RCT_REMOVE_LEGACY_ARCH
162-
auto runtimeInstallerLambda = [bridge, runtimeScheduler](facebook::jsi::Runtime &runtime) {
163-
if (!bridge) {
164-
return;
165-
}
166-
if (runtimeScheduler) {
167-
facebook::react::RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime, runtimeScheduler);
168-
}
169-
};
170-
#if USE_THIRD_PARTY_JSC != 1
171-
return std::make_unique<facebook::react::HermesExecutorFactory>(
172-
facebook::react::RCTJSIExecutorRuntimeInstaller(runtimeInstallerLambda));
173-
#endif
174-
#else
175-
// This method should not be invoked in the New Arch. So when Legacy Arch is removed, we can
176-
// safly return a nullptr.
177130
return nullptr;
178-
#endif
179131
}

packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,7 @@ - (RCTRootViewFactory *)createRCTRootViewFactory
274274

275275
configuration.sourceURLForBridge = ^NSURL *_Nullable(RCTBridge *_Nonnull bridge)
276276
{
277-
#ifndef RCT_REMOVE_LEGACY_ARCH
278-
return [weakSelf.delegate sourceURLForBridge:bridge];
279-
#else
280-
// When the Legacy Arch is removed, the Delegate does not have a sourceURLForBridge method
281277
return [weakSelf.delegate bundleURL];
282-
#endif
283278
};
284279

285280
if ([self.delegate respondsToSelector:@selector(extraModulesForBridge:)]) {
@@ -289,52 +284,6 @@ - (RCTRootViewFactory *)createRCTRootViewFactory
289284
};
290285
}
291286

292-
#ifndef RCT_REMOVE_LEGACY_ARCH
293-
// When the Legacy Arch is removed, the Delegate does not have a extraLazyModuleClassesForBridge method
294-
if ([self.delegate respondsToSelector:@selector(extraLazyModuleClassesForBridge:)]) {
295-
configuration.extraLazyModuleClassesForBridge =
296-
^NSDictionary<NSString *, Class> *_Nonnull(RCTBridge *_Nonnull bridge)
297-
{
298-
return [weakSelf.delegate extraLazyModuleClassesForBridge:bridge];
299-
};
300-
}
301-
#endif
302-
303-
#ifndef RCT_REMOVE_LEGACY_ARCH
304-
// When the Legacy Arch is removed, the Delegate does not have a bridge:didNotFindModule method
305-
// We return NO, because if we have invoked this method is unlikely that the module will be actually registered
306-
if ([self.delegate respondsToSelector:@selector(bridge:didNotFindModule:)]) {
307-
configuration.bridgeDidNotFindModule = ^BOOL(RCTBridge *_Nonnull bridge, NSString *_Nonnull moduleName) {
308-
return [weakSelf.delegate bridge:bridge didNotFindModule:moduleName];
309-
};
310-
}
311-
#endif
312-
313-
#ifndef RCT_REMOVE_LEGACY_ARCH
314-
// When the Legacy Arch is removed, the Delegate does not have a
315-
// loadSourceForBridge:onProgress:onComplete: method
316-
// We then call the loadBundleAtURL:onProgress:onComplete: instead
317-
if ([self.delegate respondsToSelector:@selector(loadSourceForBridge:onProgress:onComplete:)]) {
318-
configuration.loadSourceForBridgeWithProgress =
319-
^(RCTBridge *_Nonnull bridge,
320-
RCTSourceLoadProgressBlock _Nonnull onProgress,
321-
RCTSourceLoadBlock _Nonnull loadCallback) {
322-
[weakSelf.delegate loadSourceForBridge:bridge onProgress:onProgress onComplete:loadCallback];
323-
};
324-
}
325-
#endif
326-
327-
#ifndef RCT_REMOVE_LEGACY_ARCH
328-
// When the Legacy Arch is removed, the Delegate does not have a
329-
// loadSourceForBridge:withBlock: method
330-
// We then call the loadBundleAtURL:onProgress:onComplete: instead
331-
if ([self.delegate respondsToSelector:@selector(loadSourceForBridge:withBlock:)]) {
332-
configuration.loadSourceForBridge = ^(RCTBridge *_Nonnull bridge, RCTSourceLoadBlock _Nonnull loadCallback) {
333-
[weakSelf.delegate loadSourceForBridge:bridge withBlock:loadCallback];
334-
};
335-
}
336-
#endif
337-
338287
configuration.jsRuntimeConfiguratorDelegate = self;
339288

340289
return [[RCTRootViewFactory alloc] initWithTurboModuleDelegate:self hostDelegate:self configuration:configuration];

packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -264,48 +264,6 @@ - (RCTHost *)createReactHost:(NSDictionary *)launchOptions
264264
return nil;
265265
}
266266

267-
#ifndef RCT_REMOVE_LEGACY_ARCH
268-
- (NSDictionary<NSString *, Class> *)extraLazyModuleClassesForBridge:(RCTBridge *)bridge
269-
{
270-
if (_configuration.extraLazyModuleClassesForBridge != nil) {
271-
return _configuration.extraLazyModuleClassesForBridge(bridge);
272-
}
273-
return nil;
274-
}
275-
276-
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
277-
{
278-
if (_configuration.sourceURLForBridge != nil) {
279-
return _configuration.sourceURLForBridge(bridge);
280-
}
281-
return [self bundleURL];
282-
}
283-
284-
- (BOOL)bridge:(RCTBridge *)bridge didNotFindModule:(NSString *)moduleName
285-
{
286-
if (_configuration.bridgeDidNotFindModule != nil) {
287-
return _configuration.bridgeDidNotFindModule(bridge, moduleName);
288-
}
289-
return NO;
290-
}
291-
292-
- (void)loadSourceForBridge:(RCTBridge *)bridge withBlock:(RCTSourceLoadBlock)loadCallback
293-
{
294-
if (_configuration.loadSourceForBridge != nil) {
295-
_configuration.loadSourceForBridge(bridge, loadCallback);
296-
}
297-
}
298-
299-
- (void)loadSourceForBridge:(RCTBridge *)bridge
300-
onProgress:(RCTSourceLoadProgressBlock)onProgress
301-
onComplete:(RCTSourceLoadBlock)loadCallback
302-
{
303-
if (_configuration.loadSourceForBridgeWithProgress != nil) {
304-
_configuration.loadSourceForBridgeWithProgress(bridge, onProgress, loadCallback);
305-
}
306-
}
307-
#endif
308-
309267
- (NSURL *)bundleURL
310268
{
311269
return self->_configuration.bundleURLBlock();

packages/react-native/Libraries/Image/RCTImageShadowView.h

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/react-native/Libraries/Image/RCTImageShadowView.mm

Lines changed: 0 additions & 28 deletions
This file was deleted.

packages/react-native/Libraries/Image/RCTImageView.h

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)