mjabadilla
mjabadilla

Reputation: 1043

How to react-native run in debug mode immediately

I'm always running react-native run-ios, I tend to reset the emulator content and settings from time to time for regression purposes.

In order to go into debug mode, we have to CMD+D > Debug mode, but is there a command option so that the debugging mode is enabled right after react-native run-ios (fresh install) command?

Closest question I've found is https://stackoverflow.com/a/41345139/1405577 but it does not work

$ react-native run-ios --install-debug
error: unknown option \`--install-debug'

Upvotes: 13

Views: 5128

Answers (1)

NEOline
NEOline

Reputation: 506

You can do it with setIsDebuggingRemotelyfrom NativeModules:

import { NativeModules } from 'react-native';

if (__DEV__) {
  NativeModules.DevSettings.setIsDebuggingRemotely(true)
}

Then Debug JS Remotely will be activated on start.

Upvotes: 8

Related Questions