Skip to content

Commit 084f1a7

Browse files
terriblebenKudo
andcommitted
[iOS] Remove side effects from DevTools (swizzling, module exporting)
- 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. Co-Authored-By: Kudo Chien <[email protected]> * Update patch to fit newer RCTKeyCommands.m
1 parent e42de1c commit 084f1a7

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

packages/react-native/React/Base/RCTKeyCommands.m

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,6 @@ @interface RCTKeyCommands ()
9494

9595
@implementation RCTKeyCommands
9696

97-
+ (void)initialize
98-
{
99-
SEL originalKeyEventSelector = NSSelectorFromString(@"handleKeyUIEvent:");
100-
SEL swizzledKeyEventSelector = NSSelectorFromString(
101-
[NSString stringWithFormat:@"_rct_swizzle_%x_%@", arc4random(), NSStringFromSelector(originalKeyEventSelector)]);
102-
103-
void (^handleKeyUIEventSwizzleBlock)(UIApplication *, UIEvent *) = ^(UIApplication *slf, UIEvent *event) {
104-
[[[self class] sharedInstance] handleKeyUIEventSwizzle:event];
105-
106-
((void (*)(id, SEL, id))objc_msgSend)(slf, swizzledKeyEventSelector, event);
107-
};
108-
109-
RCTSwapInstanceMethodWithBlock(
110-
[UIApplication class], originalKeyEventSelector, handleKeyUIEventSwizzleBlock, swizzledKeyEventSelector);
111-
}
112-
11397
- (void)handleKeyUIEventSwizzle:(UIEvent *)event
11498
{
11599
NSString *modifiedInput = nil;

0 commit comments

Comments
 (0)