From 784c86271e1ed49638d7fb96841bf310d6cddf62 Mon Sep 17 00:00:00 2001 From: Edmond Chui Date: Tue, 8 Oct 2024 16:34:29 -0700 Subject: [PATCH] Fusebox reload-to-profile (#46856) Summary: Changelog: [General][Added] - Add support for reload-to-profile in Fusebox. CDT: https://github.com/facebookexperimental/rn-chrome-devtools-frontend/pull/117 React: https://github.com/facebook/react/pull/31021 This diff adds support for reload2profile under bridge and bridgeless for iOS, Android, and C++ Reviewed By: hoxyq Differential Revision: D63233256 --- .../RCTDevToolsRuntimeSettingsModule.h | 12 ++++ .../RCTDevToolsRuntimeSettingsModule.mm | 58 +++++++++++++++++++ .../ReactAndroid/api/ReactAndroid.api | 6 ++ .../ReactAndroid/build.gradle.kts | 4 ++ .../ReactDevToolsRuntimeSettingsModule.kt | 48 +++++++++++++++ .../react/shell/MainReactPackage.java | 5 ++ .../devtoolsruntimesettings/CMakeLists.txt | 22 +++++++ .../DevToolsRuntimeSettings.cpp | 27 +++++++++ .../DevToolsRuntimeSettings.h | 56 ++++++++++++++++++ .../nativemodule/defaults/CMakeLists.txt | 1 + .../defaults/DefaultTurboModules.cpp | 10 ++++ .../devtoolsruntimesettings/CMakeLists.txt | 24 ++++++++ .../DevToolsRuntimeSettingsModule.cpp | 35 +++++++++++ .../DevToolsRuntimeSettingsModule.h | 27 +++++++++ .../devtoolsruntimesettings/README.md | 6 ++ ...ativeReactDevToolsRuntimeSettingsModule.js | 34 +++++++++++ 16 files changed, 375 insertions(+) create mode 100644 packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.h create mode 100644 packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.mm create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/devtoolsruntimesettings/ReactDevToolsRuntimeSettingsModule.kt create mode 100644 packages/react-native/ReactCommon/devtoolsruntimesettings/CMakeLists.txt create mode 100644 packages/react-native/ReactCommon/devtoolsruntimesettings/DevToolsRuntimeSettings.cpp create mode 100644 packages/react-native/ReactCommon/devtoolsruntimesettings/DevToolsRuntimeSettings.h create mode 100644 packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/CMakeLists.txt create mode 100644 packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/DevToolsRuntimeSettingsModule.cpp create mode 100644 packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/DevToolsRuntimeSettingsModule.h create mode 100644 packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/README.md create mode 100644 packages/react-native/src/private/fusebox/specs/NativeReactDevToolsRuntimeSettingsModule.js diff --git a/packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.h b/packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.h new file mode 100644 index 00000000000000..a400bbed0040f5 --- /dev/null +++ b/packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@interface RCTDevToolsRuntimeSettingsModule : NSObject + +@end diff --git a/packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.mm b/packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.mm new file mode 100644 index 00000000000000..f7654940363da2 --- /dev/null +++ b/packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.mm @@ -0,0 +1,58 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import +#import + +#import "CoreModulesPlugins.h" + +struct Config { + bool shouldReloadAndProfile = false; + bool recordChangeDescriptions = false; +}; + +// static to persist across Turbo Module reloads +static Config _config; + +@interface RCTDevToolsRuntimeSettingsModule () { +} +@end + +@implementation RCTDevToolsRuntimeSettingsModule +RCT_EXPORT_MODULE(ReactDevToolsRuntimeSettingsModule) + +RCT_EXPORT_METHOD(setReloadAndProfileConfig + : (JS::NativeReactDevToolsRuntimeSettingsModule::PartialReloadAndProfileConfig &)config) +{ + if (config.shouldReloadAndProfile().has_value()) { + _config.shouldReloadAndProfile = config.shouldReloadAndProfile().value(); + } + if (config.recordChangeDescriptions().has_value()) { + _config.recordChangeDescriptions = config.recordChangeDescriptions().value(); + } +} + +RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getReloadAndProfileConfig) +{ + return @{ + @"shouldReloadAndProfile" : @(_config.shouldReloadAndProfile), + @"recordChangeDescriptions" : @(_config.recordChangeDescriptions), + }; +} + +- (std::shared_ptr)getTurboModule: + (const facebook::react::ObjCTurboModule::InitParams &)params +{ + return std::make_shared(params); +} + +@end + +Class RCTDevToolsRuntimeSettingsCls(void) +{ + return RCTDevToolsRuntimeSettingsModule.class; +} diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 57530f104874ea..a58192b9fa8b08 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -3373,6 +3373,12 @@ public final class com/facebook/react/modules/devloading/DevLoadingModule : com/ public final class com/facebook/react/modules/devloading/DevLoadingModule$Companion { } +public final class com/facebook/react/modules/devtoolsruntimesettings/ReactDevToolsRuntimeSettingsModule : com/facebook/fbreact/specs/NativeReactDevToolsRuntimeSettingsModuleSpec { + public fun (Lcom/facebook/react/bridge/ReactApplicationContext;)V + public fun getReloadAndProfileConfig ()Lcom/facebook/react/bridge/WritableMap; + public fun setReloadAndProfileConfig (Lcom/facebook/react/bridge/ReadableMap;)V +} + public class com/facebook/react/modules/dialog/AlertFragment : androidx/fragment/app/DialogFragment, android/content/DialogInterface$OnClickListener { public fun ()V public fun (Lcom/facebook/react/modules/dialog/DialogModule$AlertFragmentListener;Landroid/os/Bundle;)V diff --git a/packages/react-native/ReactAndroid/build.gradle.kts b/packages/react-native/ReactAndroid/build.gradle.kts index 1ce7e621ad50e0..cd4d907728d615 100644 --- a/packages/react-native/ReactAndroid/build.gradle.kts +++ b/packages/react-native/ReactAndroid/build.gradle.kts @@ -106,6 +106,10 @@ val preparePrefab by Pair("../ReactCommon/cxxreact/", "cxxreact/"), // react_featureflags Pair("../ReactCommon/react/featureflags/", "react/featureflags/"), + // react_devtoolsruntimesettings + Pair( + "../ReactCommon/react/devtoolsruntimesettings/", + "react/devtoolsruntimesettings/"), // react_render_animations Pair( "../ReactCommon/react/renderer/animations/", diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/devtoolsruntimesettings/ReactDevToolsRuntimeSettingsModule.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/devtoolsruntimesettings/ReactDevToolsRuntimeSettingsModule.kt new file mode 100644 index 00000000000000..63e30b7cd96383 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/devtoolsruntimesettings/ReactDevToolsRuntimeSettingsModule.kt @@ -0,0 +1,48 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.modules.devtoolsruntimesettings + +import com.facebook.fbreact.specs.NativeReactDevToolsRuntimeSettingsModuleSpec +import com.facebook.jni.annotations.DoNotStripAny +import com.facebook.react.bridge.Arguments +import com.facebook.react.bridge.ReactApplicationContext +import com.facebook.react.bridge.ReadableMap +import com.facebook.react.bridge.WritableMap +import com.facebook.react.module.annotations.ReactModule + +private class Settings { + var shouldReloadAndProfile: Boolean = false + var recordChangeDescriptions: Boolean = false +} + +@DoNotStripAny +@ReactModule(name = NativeReactDevToolsRuntimeSettingsModuleSpec.NAME) +public class ReactDevToolsRuntimeSettingsModule(reactContext: ReactApplicationContext?) : + NativeReactDevToolsRuntimeSettingsModuleSpec(reactContext) { + + // static to persist across Turbo Module reloads + private companion object { + private val settings = Settings() + } + + override fun setReloadAndProfileConfig(map: ReadableMap) { + if (map.hasKey("shouldReloadAndProfile")) { + settings.shouldReloadAndProfile = map.getBoolean("shouldReloadAndProfile") + } + if (map.hasKey("recordChangeDescriptions")) { + settings.recordChangeDescriptions = map.getBoolean("recordChangeDescriptions") + } + } + + override fun getReloadAndProfileConfig(): WritableMap { + val map = Arguments.createMap() + map.putBoolean("shouldReloadAndProfile", settings.shouldReloadAndProfile) + map.putBoolean("recordChangeDescriptions", settings.recordChangeDescriptions) + return map + } +} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java index 68c405ad02ba3a..089c0b2e523c7f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java @@ -28,6 +28,7 @@ import com.facebook.react.modules.camera.ImageStoreManager; import com.facebook.react.modules.clipboard.ClipboardModule; import com.facebook.react.modules.devloading.DevLoadingModule; +import com.facebook.react.modules.devtoolsruntimesettings.ReactDevToolsRuntimeSettingsModule; import com.facebook.react.modules.dialog.DialogModule; import com.facebook.react.modules.fresco.FrescoModule; import com.facebook.react.modules.i18nmanager.I18nManagerModule; @@ -88,6 +89,7 @@ NetworkingModule.class, PermissionsModule.class, ReactDevToolsSettingsManagerModule.class, + ReactDevToolsRuntimeSettingsModule.class, ShareModule.class, SoundManagerModule.class, StatusBarModule.class, @@ -156,6 +158,8 @@ public MainReactPackage(MainPackageConfig config) { return new WebSocketModule(context); case ReactDevToolsSettingsManagerModule.NAME: return new ReactDevToolsSettingsManagerModule(context); + case ReactDevToolsRuntimeSettingsModule.NAME: + return new ReactDevToolsRuntimeSettingsModule(context); default: return null; } @@ -302,6 +306,7 @@ private ReactModuleInfoProvider fallbackForMissingClass() { NetworkingModule.class, PermissionsModule.class, ReactDevToolsSettingsManagerModule.class, + ReactDevToolsRuntimeSettingsModule.class, ShareModule.class, StatusBarModule.class, SoundManagerModule.class, diff --git a/packages/react-native/ReactCommon/devtoolsruntimesettings/CMakeLists.txt b/packages/react-native/ReactCommon/devtoolsruntimesettings/CMakeLists.txt new file mode 100644 index 00000000000000..244fabb9cca851 --- /dev/null +++ b/packages/react-native/ReactCommon/devtoolsruntimesettings/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.13) +set(CMAKE_VERBOSE_MAKEFILE on) + +add_compile_options( + -fexceptions + -frtti + -std=c++20 + -Wall + -Wpedantic) + +add_library(react_devtoolsruntimesettingscxx INTERFACE) + +target_include_directories(react_devtoolsruntimesettingscxx INTERFACE .) + +target_link_libraries(react_devtoolsruntimesettingscxx + jsi +) diff --git a/packages/react-native/ReactCommon/devtoolsruntimesettings/DevToolsRuntimeSettings.cpp b/packages/react-native/ReactCommon/devtoolsruntimesettings/DevToolsRuntimeSettings.cpp new file mode 100644 index 00000000000000..02f4da23d92ff1 --- /dev/null +++ b/packages/react-native/ReactCommon/devtoolsruntimesettings/DevToolsRuntimeSettings.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "DevToolsRuntimeSettings.h" + +namespace facebook::react { + +void DevToolsRuntimeSettings::setReloadAndProfileConfig( + NativePartialReloadAndProfileConfig config) { + if (config.shouldReloadAndProfile.has_value()) { + _config.shouldReloadAndProfile = config.shouldReloadAndProfile.value(); + } + if (config.shouldReloadAndProfile.has_value()) { + _config.recordChangeDescriptions = config.recordChangeDescriptions.value(); + } +}; + +NativeReloadAndProfileConfig +DevToolsRuntimeSettings::getReloadAndProfileConfig() const { + return _config; +}; + +} // namespace facebook::react diff --git a/packages/react-native/ReactCommon/devtoolsruntimesettings/DevToolsRuntimeSettings.h b/packages/react-native/ReactCommon/devtoolsruntimesettings/DevToolsRuntimeSettings.h new file mode 100644 index 00000000000000..aa6ae8dd750879 --- /dev/null +++ b/packages/react-native/ReactCommon/devtoolsruntimesettings/DevToolsRuntimeSettings.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include + +namespace facebook::react { + +using NativePartialReloadAndProfileConfig = + NativeReactDevToolsRuntimeSettingsModulePartialReloadAndProfileConfig< + std::optional, + std::optional>; + +template <> +struct Bridging + : NativeReactDevToolsRuntimeSettingsModulePartialReloadAndProfileConfigBridging< + NativePartialReloadAndProfileConfig> {}; + +using NativeReloadAndProfileConfig = + NativeReactDevToolsRuntimeSettingsModuleReloadAndProfileConfig; + +template <> +struct Bridging + : NativeReactDevToolsRuntimeSettingsModuleReloadAndProfileConfigBridging< + NativeReloadAndProfileConfig> {}; + +class DevToolsRuntimeSettings { + public: + // static to persist across Turbo Module reloads + static DevToolsRuntimeSettings& getInstance() { + static DevToolsRuntimeSettings instance; + return instance; + } + + private: + NativeReloadAndProfileConfig _config; + + DevToolsRuntimeSettings() : _config() {} + + public: + ~DevToolsRuntimeSettings() = default; + DevToolsRuntimeSettings(const DevToolsRuntimeSettings&) = delete; + DevToolsRuntimeSettings(DevToolsRuntimeSettings&&) = delete; + void operator=(const DevToolsRuntimeSettings&) = delete; + void operator=(DevToolsRuntimeSettings&&) = delete; + + void setReloadAndProfileConfig(NativePartialReloadAndProfileConfig config); + NativeReloadAndProfileConfig getReloadAndProfileConfig() const; +}; + +} // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/nativemodule/defaults/CMakeLists.txt b/packages/react-native/ReactCommon/react/nativemodule/defaults/CMakeLists.txt index 952ffe520cc589..7984050cbdec1d 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/defaults/CMakeLists.txt +++ b/packages/react-native/ReactCommon/react/nativemodule/defaults/CMakeLists.txt @@ -21,6 +21,7 @@ target_include_directories(react_nativemodule_defaults PUBLIC ${REACT_COMMON_DIR target_link_libraries(react_nativemodule_defaults react_nativemodule_dom + react_nativemodule_devtoolsruntimesettings react_nativemodule_featureflags react_nativemodule_microtasks react_nativemodule_idlecallbacks diff --git a/packages/react-native/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp b/packages/react-native/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp index 1e0201666d2c59..2d857ec8686009 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp @@ -11,6 +11,10 @@ #include #include +#ifdef HERMES_ENABLE_DEBUGGER +#include +#endif + namespace facebook::react { /* static */ std::shared_ptr DefaultTurboModules::getTurboModule( @@ -32,6 +36,12 @@ namespace facebook::react { return std::make_shared(jsInvoker); } +#ifdef HERMES_ENABLE_DEBUGGER + if (name == DevToolsRuntimeSettingsModule::kModuleName) { + return std::make_shared(jsInvoker); + } +#endif + return nullptr; } diff --git a/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/CMakeLists.txt b/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/CMakeLists.txt new file mode 100644 index 00000000000000..318e0f5d6b1075 --- /dev/null +++ b/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.13) +set(CMAKE_VERBOSE_MAKEFILE on) + +add_compile_options( + -fexceptions + -frtti + -std=c++20 + -Wall + -Wpedantic + -DLOG_TAG=\"ReactNative\") + +file(GLOB react_nativemodule_devtoolsruntimesettings_SRC CONFIGURE_DEPENDS *.cpp) +add_library(react_nativemodule_devtoolsruntimesettings OBJECT ${react_nativemodule_devtoolsruntimesettings_SRC}) + +target_include_directories(react_nativemodule_devtoolsruntimesettings PUBLIC ${REACT_COMMON_DIR}) + +target_link_libraries(react_nativemodule_devtoolsruntimesettings + react_devtoolsruntimesettingscxx +) diff --git a/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/DevToolsRuntimeSettingsModule.cpp b/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/DevToolsRuntimeSettingsModule.cpp new file mode 100644 index 00000000000000..4b0e5ca0bd2f6a --- /dev/null +++ b/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/DevToolsRuntimeSettingsModule.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "DevToolsRuntimeSettingsModule.h" +#include "Plugins.h" + +std::shared_ptr +ReactDevToolsRuntimeSettingsModuleProvider( + std::shared_ptr jsInvoker) { + return std::make_shared( + std::move(jsInvoker)); +} + +namespace facebook::react { + +DevToolsRuntimeSettingsModule::DevToolsRuntimeSettingsModule( + std::shared_ptr jsInvoker) + : NativeReactDevToolsRuntimeSettingsModuleCxxSpec(std::move(jsInvoker)) {} + +void DevToolsRuntimeSettingsModule::setReloadAndProfileConfig( + jsi::Runtime& /*rt*/, + NativePartialReloadAndProfileConfig config) { + DevToolsRuntimeSettings::getInstance().setReloadAndProfileConfig(config); +}; + +NativeReloadAndProfileConfig +DevToolsRuntimeSettingsModule::getReloadAndProfileConfig(jsi::Runtime& /*rt*/) { + return DevToolsRuntimeSettings::getInstance().getReloadAndProfileConfig(); +}; + +} // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/DevToolsRuntimeSettingsModule.h b/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/DevToolsRuntimeSettingsModule.h new file mode 100644 index 00000000000000..6f4d54aeb1c70c --- /dev/null +++ b/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/DevToolsRuntimeSettingsModule.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include "devtoolsruntimesettingscxx/DevToolsRuntimeSettings.h" + +namespace facebook::react { + +class DevToolsRuntimeSettingsModule + : public NativeReactDevToolsRuntimeSettingsModuleCxxSpec< + DevToolsRuntimeSettingsModule> { + public: + DevToolsRuntimeSettingsModule(std::shared_ptr jsInvoker); + + void setReloadAndProfileConfig( + jsi::Runtime& rt, + NativePartialReloadAndProfileConfig config); + + NativeReloadAndProfileConfig getReloadAndProfileConfig(jsi::Runtime& rt); +}; + +} // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/README.md b/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/README.md new file mode 100644 index 00000000000000..cbf4f5d7430569 --- /dev/null +++ b/packages/react-native/ReactCommon/react/nativemodule/devtoolsruntimesettings/README.md @@ -0,0 +1,6 @@ +# Options for DevTools Settings + +| Module | Survives native restarts | Survives JavaScript VM restarts | +| --- | --- | --- | +| DevToolsRuntimeSettings | No | Yes +| DevToolsSettings | Yes | Yes diff --git a/packages/react-native/src/private/fusebox/specs/NativeReactDevToolsRuntimeSettingsModule.js b/packages/react-native/src/private/fusebox/specs/NativeReactDevToolsRuntimeSettingsModule.js new file mode 100644 index 00000000000000..7f6f48a5d26be1 --- /dev/null +++ b/packages/react-native/src/private/fusebox/specs/NativeReactDevToolsRuntimeSettingsModule.js @@ -0,0 +1,34 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @oncall react_native + */ + +import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; + +import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; + +export type ReloadAndProfileConfig = { + shouldReloadAndProfile: boolean, + recordChangeDescriptions: boolean, +}; + +// Linter doesn't speak Flow's `Partial` type +export type PartialReloadAndProfileConfig = { + shouldReloadAndProfile?: boolean, + recordChangeDescriptions?: boolean, +}; + +export interface Spec extends TurboModule { + +setReloadAndProfileConfig: (config: PartialReloadAndProfileConfig) => void; + +getReloadAndProfileConfig: () => ReloadAndProfileConfig; +} + +export default (TurboModuleRegistry.get( + 'ReactDevToolsRuntimeSettingsModule', +): ?Spec);