Skip to content

Commit 56f2d76

Browse files
christophpurrermeta-codesync[bot]
authored andcommitted
Remove legacy architecture code guarded by RCT_REMOVE_LEGACY_ARCH from RN iOS
Summary: Changelog: [Internal] Remove legacy architecture code guarded by RCT_REMOVE_LEGACY_ARCH from RN iOS Differential Revision: D104495793
1 parent 0ff4c85 commit 56f2d76

143 files changed

Lines changed: 2 additions & 14954 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/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/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)