Skip to content

Commit bfed766

Browse files
committed
Example wiring up the inspector flag
1 parent 4740af3 commit bfed766

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

packages/playground/windows/playground-win32/Playground-Win32.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ struct WindowData {
8585

8686
winrt::Microsoft::ReactNative::ReactNativeHost Host() noexcept {
8787
if (!m_host) {
88+
winrt::Microsoft::ReactNative::QuirkSettings::SetUseFusebox(true);
8889
m_host = winrt::Microsoft::ReactNative::ReactNativeHost();
8990
m_host.InstanceSettings(InstanceSettings());
9091
}

vnext/Microsoft.ReactNative/QuirkSettings.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,26 @@
99
#include "React.h"
1010
#include "ReactPropertyBag.h"
1111

12+
#include <react/featureflags/ReactNativeFeatureFlags.h>
13+
#include <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
14+
1215
namespace winrt::Microsoft::ReactNative::implementation {
1316

1417
QuirkSettings::QuirkSettings() noexcept {}
1518

19+
class QuirkSettingsReactNativeFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {
20+
public:
21+
QuirkSettingsReactNativeFeatureFlags(bool enableModernCDPRegistry)
22+
: m_enableModernCDPRegistry(enableModernCDPRegistry) {}
23+
24+
bool inspectorEnableModernCDPRegistry() override {
25+
return m_enableModernCDPRegistry;
26+
}
27+
28+
private:
29+
bool m_enableModernCDPRegistry;
30+
};
31+
1632
winrt::Microsoft::ReactNative::ReactPropertyId<bool> MatchAndroidAndIOSStretchBehaviorProperty() noexcept {
1733
static winrt::Microsoft::ReactNative::ReactPropertyId<bool> propId{
1834
L"ReactNative.QuirkSettings", L"MatchAndroidAndIOSyStretchBehavior"};
@@ -137,6 +153,10 @@ winrt::Microsoft::ReactNative::ReactPropertyId<bool> IsBridgelessProperty() noex
137153
ReactPropertyBag(settings.Properties()).Set(UseRuntimeSchedulerProperty(), value);
138154
}
139155

156+
/*static*/ void QuirkSettings::SetUseFusebox(bool value) noexcept {
157+
facebook::react::ReactNativeFeatureFlags::override(std::make_unique<QuirkSettingsReactNativeFeatureFlags>(value));
158+
}
159+
140160
#pragma endregion IDL interface
141161

142162
/*static*/ bool QuirkSettings::GetMatchAndroidAndIOSStretchBehavior(ReactPropertyBag properties) noexcept {

vnext/Microsoft.ReactNative/QuirkSettings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ struct QuirkSettings : QuirkSettingsT<QuirkSettings> {
6868
winrt::Microsoft::ReactNative::ReactInstanceSettings settings,
6969
bool value) noexcept;
7070

71+
static void SetUseFusebox(bool value) noexcept;
72+
7173
#pragma endregion Public API - part of IDL interface
7274
};
7375

vnext/Microsoft.ReactNative/QuirkSettings.idl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ namespace Microsoft.ReactNative
6464
"By default `react-native-windows` will use the new RuntimeScheduler."
6565
"Setting this to false will revert the behavior to previous scheduling logic.")
6666
static void SetUseRuntimeScheduler(ReactInstanceSettings settings, Boolean value);
67+
68+
DOC_STRING(
69+
"By default `react-native-windows` uses the legacy inspector packager connection protocol."
70+
"Setting this to true to enable the modern \"Fusebox\" debugging functionality.")
71+
static void SetUseFusebox(Boolean value);
6772
}
6873

6974
} // namespace Microsoft.ReactNative

0 commit comments

Comments
 (0)