1

如何在 react native 中运行的第一个应用程序上启动远程调试?

我使用开发人员菜单启动Debug JS Remotely并重新加载应用程序,因此无法调试仅在第一次运行时出现的代码。

4

2 回答 2

2

我终于在这篇文章中找到了解决方案。

可以以Debug JS Remotely编程方式启动iOS

import { NativeModules } from 'react-native';

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

需要react-native-devsettings-android库才能运行此代码android

于 2019-01-27T13:22:53.553 回答
1

您需要用本机代码对其进行硬编码。

对于android,我相信它是这个:

https://github.com/facebook/react-native/blob/786c1ecc2a6856967d676da68eb02f89eb38fb79/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java#L88

于 2018-07-17T11:08:54.397 回答