Skip to content

Commit 18916f3

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Fix Open Debugger dev menu item missing from iOS Bridgeless
Summary: After a [recent change](90296be) we break part of the integration with the debug menu, which is was using the presence/absence of the bridge to decide whether we were in bridge or bridgeless. For backward compatibility reasosn, the bridge ivar is now populated with the bridgeProxy, so just checking whether is nil or not is not enough to verify whether we are in bridge or in bridgeless mode anymore. ## Changelog: [iOS][Fixed] - Make sure that the Open Debugger appears in bridgeless mode Reviewed By: fkgozali Differential Revision: D56067897 fbshipit-source-id: e2501ed730ff35bc755c24ef400130c551032e28
1 parent 776f900 commit 18916f3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/react-native/React/CoreModules/RCTDevSettings.mm

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ + (BOOL)requiresMainQueueSetup
158158
return NO;
159159
}
160160

161+
- (BOOL)_isBridgeMode
162+
{
163+
return [self.bridge isKindOfClass:[RCTBridge class]];
164+
}
165+
161166
- (instancetype)initWithDataSource:(id<RCTDevSettingsDataSource>)dataSource
162167
{
163168
if (self = [super init]) {
@@ -178,7 +183,7 @@ - (instancetype)initWithDataSource:(id<RCTDevSettingsDataSource>)dataSource
178183
- (void)initialize
179184
{
180185
#if RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION
181-
if (self.bridge) {
186+
if ([self _isBridgeMode]) {
182187
RCTBridge *__weak weakBridge = self.bridge;
183188
_bridgeExecutorOverrideToken = [[RCTPackagerConnection sharedPackagerConnection]
184189
addNotificationHandler:^(id params) {
@@ -209,7 +214,7 @@ - (void)initialize
209214
#endif
210215

211216
#if RCT_ENABLE_INSPECTOR
212-
if (self.bridge) {
217+
if ([self _isBridgeMode]) {
213218
// We need this dispatch to the main thread because the bridge is not yet
214219
// finished with its initialisation. By the time it relinquishes control of
215220
// the main thread, this operation can be performed.
@@ -250,7 +255,7 @@ - (void)invalidate
250255
{
251256
[super invalidate];
252257
#if RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION
253-
if (self.bridge) {
258+
if ([self _isBridgeMode]) {
254259
[[RCTPackagerConnection sharedPackagerConnection] removeHandler:_bridgeExecutorOverrideToken];
255260
}
256261

@@ -281,7 +286,7 @@ - (id)settingForKey:(NSString *)key
281286
- (BOOL)isDeviceDebuggingAvailable
282287
{
283288
#if RCT_ENABLE_INSPECTOR
284-
if (self.bridge) {
289+
if ([self _isBridgeMode]) {
285290
return self.bridge.isInspectable;
286291
} else {
287292
return self.isInspectable;

0 commit comments

Comments
 (0)