Skip to content

Commit bdd9e16

Browse files
authored
fix(ios): handle isDebuggingRemotely being removed in 0.79 (#2380)
1 parent 4501adc commit bdd9e16

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
android:usesCleartextTraffic="true"
2222
tools:targetApi="m"
2323
>
24-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
25-
2624
<activity android:name="com.microsoft.reacttestapp.MainActivity" android:exported="true">
2725
<intent-filter>
2826
<action android:name="android.intent.action.MAIN" />

ios/ReactTestApp/React+Compatibility.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ NS_ASSUME_NONNULL_BEGIN
44

55
NSURL *RTADefaultJSBundleURL();
66

7+
void RTADisableRemoteDebugging();
8+
79
IMP RTASwizzleSelector(Class class, SEL originalSelector, SEL swizzledSelector);
810

911
NS_ASSUME_NONNULL_END

ios/ReactTestApp/React+Compatibility.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
#define MAKE_VERSION(maj, min, patch) ((maj * 1000000) + (min * 1000) + patch)
1414

15+
#if REACT_NATIVE_VERSION < MAKE_VERSION(0, 79, 0)
16+
#import <React/RCTDevSettings.h>
17+
#endif
18+
1519
IMP RTASwizzleSelector(Class class, SEL originalSelector, SEL swizzledSelector)
1620
{
1721
Method originalMethod = class_getInstanceMethod(class, originalSelector);
@@ -33,6 +37,16 @@ IMP RTASwizzleSelector(Class class, SEL originalSelector, SEL swizzledSelector)
3337
return originalImpl;
3438
}
3539

40+
// MARK: - [0.79.0] `isDebuggingRemotely` was removed
41+
// See https://github.com/facebook/react-native/commit/9aae84a688b5af87faf4b68676b6357de26f797f
42+
43+
void RTADisableRemoteDebugging()
44+
{
45+
#if REACT_NATIVE_VERSION < MAKE_VERSION(0, 79, 0)
46+
[[RCTDevSettings alloc] init].isDebuggingRemotely = NO;
47+
#endif
48+
}
49+
3650
// MARK: - [0.71.13] The additional `inlineSourceMap:` was added in 0.71.13
3751
// See https://github.com/facebook/react-native/commit/f7219ec02d71d2f0f6c71af4d5c3d4850a898fd8
3852

ios/ReactTestApp/ReactInstance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ final class ReactInstance: NSObject, RNXHostConfig {
8181
// When loading the embedded bundle, we must disable remote
8282
// debugging to prevent the bridge from getting stuck in
8383
// -[RCTWebSocketExecutor executeApplicationScript:sourceURL:onComplete:]
84-
RCTDevSettings().isDebuggingRemotely = false
84+
RTADisableRemoteDebugging()
8585
}
8686
RCTTriggerReloadCommandListeners("ReactTestApp")
8787
return

0 commit comments

Comments
 (0)