Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose DevSettings.openDebugger method to JS #44647

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/react-native/React/CoreModules/RCTDevSettings.mm
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,15 @@ - (void)setupHMRClientWithAdditionalBundleURL:(NSURL *)bundleURL
}
}

RCT_EXPORT_METHOD(openDebugger)
{
#ifdef RCT_ENABLE_INSPECTOR
[RCTInspectorDevServerHelper
openDebugger:self.bundleManager.bundleURL
withErrorMessage:@"Failed to open debugger. Please check that the dev server is running and reload the app."];
#endif
}

#pragma mark - Internal

/**
Expand Down Expand Up @@ -608,6 +617,9 @@ - (void)setupHMRClientWithBundleURL:(NSURL *)bundleURL
- (void)setupHMRClientWithAdditionalBundleURL:(NSURL *)bundleURL
{
}
- (void)openDebugger
{
}
- (void)addMenuItem:(NSString *)title
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public class DevSettingsModule(
}
}

override fun openDebugger() {
devSupportManager.openDebugger()
}

override fun setIsShakeToShowDevMenuEnabled(enabled: Boolean) {
// iOS only
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface Spec extends TurboModule {
+setProfilingEnabled: (isProfilingEnabled: boolean) => void;
+toggleElementInspector: () => void;
+addMenuItem: (title: string) => void;
+openDebugger?: () => void;

// Events
+addListener: (eventName: string) => void;
Expand Down