Skip to content

Commit

Permalink
[iOS] Remove side effects from DevTools (swizzling, module exporting)
Browse files Browse the repository at this point in the history
- Remove swizzling from dev tools
- Remove RCT_EXPORT_MODULE from RCTDevMenu

Do not use RCT_EXPORT_MODULE in RCTDevMenu

Because this class swizzles a system method inside `initialize`, all the versions of RCTDevMenu conflict with each other when we use RCT_EXPORT_MODULE because they are all referenced immediately at runtime.
  • Loading branch information
terribleben authored and vonovak committed Feb 21, 2025
1 parent 74a6807 commit 46879fb
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions packages/react-native/React/CoreModules/RCTDevMenu.mm
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,7 @@ @implementation RCTDevMenu {
@synthesize callableJSModules = _callableJSModules;
@synthesize bundleManager = _bundleManager;

RCT_EXPORT_MODULE()

+ (void)initialize
{
// We're swizzling here because it's poor form to override methods in a category,
// however UIWindow doesn't actually implement motionEnded:withEvent:, so there's
// no need to call the original implementation.
RCTSwapInstanceMethods([UIWindow class], @selector(motionEnded:withEvent:), @selector(RCT_motionEnded:withEvent:));
}
+ (NSString *)moduleName { return @"RCTDevMenu"; }

+ (BOOL)requiresMainQueueSetup
{
Expand Down

0 comments on commit 46879fb

Please sign in to comment.