From 95f633e054b4398e150729c96707398369a0d871 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 21 Apr 2020 09:35:10 -0700 Subject: [PATCH 1/3] Fix devtools connection to match RN0.62 --- vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp b/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp index bd5a340f130..e6da5269ad2 100644 --- a/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp +++ b/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp @@ -564,6 +564,13 @@ void ReactRootControl::ShowDeveloperMenu() noexcept { auto xamlRootGrid{xamlRootView.as()}; xamlRootGrid.Children().Append(m_developerMenuRoot); } + + // Notify instance that dev menu is shown -- This is used to trigger a connection to dev tools + if (auto instance = m_weakReactInstance.GetStrongPtr()) { + auto innerInstance = query_cast(*instance).GetInnerInstance(); + innerInstance->callJSFunction( + "RCTNativeAppEventEmitter", "emit", folly::dynamic::array("RCTDevMenuShown")); + } } void ReactRootControl::DismissDeveloperMenu() noexcept { From a92fd255848c6d3c8488a85d05574afd4187e7e7 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 21 Apr 2020 09:35:21 -0700 Subject: [PATCH 2/3] Change files --- ...ct-native-windows-2020-04-21-09-35-21-devtoolsfix.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 change/react-native-windows-2020-04-21-09-35-21-devtoolsfix.json diff --git a/change/react-native-windows-2020-04-21-09-35-21-devtoolsfix.json b/change/react-native-windows-2020-04-21-09-35-21-devtoolsfix.json new file mode 100644 index 00000000000..817ca55ac1f --- /dev/null +++ b/change/react-native-windows-2020-04-21-09-35-21-devtoolsfix.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "Fix devtools connection to match RN0.62", + "packageName": "react-native-windows", + "email": "acoates@microsoft.com", + "dependentChangeType": "patch", + "date": "2020-04-21T16:35:21.511Z" +} \ No newline at end of file From 2444e8f8bf0510bf495fe286eee27ed22bde1164 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 21 Apr 2020 10:55:32 -0700 Subject: [PATCH 3/3] review feedback --- vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp b/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp index e6da5269ad2..7b73c9bc060 100644 --- a/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp +++ b/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp @@ -567,8 +567,7 @@ void ReactRootControl::ShowDeveloperMenu() noexcept { // Notify instance that dev menu is shown -- This is used to trigger a connection to dev tools if (auto instance = m_weakReactInstance.GetStrongPtr()) { - auto innerInstance = query_cast(*instance).GetInnerInstance(); - innerInstance->callJSFunction( + query_cast(*instance).CallJsFunction( "RCTNativeAppEventEmitter", "emit", folly::dynamic::array("RCTDevMenuShown")); } }