From aef65c1f96105e36b09e0dda814d173121540a16 Mon Sep 17 00:00:00 2001 From: Andrew Coates <30809111+acoates-ms@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:44:27 -0700 Subject: [PATCH 1/4] Enforce StatusBarManger module aligns with Spec --- .../Modules/StatusBarManager.h | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h b/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h index 53c3018ae6b..1cb994b89a6 100644 --- a/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h +++ b/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h @@ -4,9 +4,36 @@ #include +#include "codegen/NativeStatusBarManagerAndroidSpec.g.h" + namespace Microsoft::ReactNative { REACT_MODULE(StatusBarManager) -struct StatusBarManager {}; +struct StatusBarManager { +using ModuleSpec = Microsoft::ReactNativeSpecs::StatusBarManagerAndroidSpec; + +REACT_GET_CONSTANTS(GetConstants) +static Microsoft::ReactNativeSpecs::StatusBarManagerAndroidSpec_Constants GetConstants() noexcept { + //return {{"HEIGHT", 0}, {"DEFAULT_BACKGROUND_COLOR": 0}}; + return {0}; +} + +REACT_METHOD(setColor) +static void setColor(double /*color*/, bool /*animated*/) noexcept { +} + +REACT_METHOD(setTranslucent) +static void setTranslucent(bool /*translucent*/) noexcept { +} + +REACT_METHOD(setStyle) +static void setStyle(std::optional /*statusBarStyle*/) noexcept { +} + +REACT_METHOD(setHidden) +static void setHidden(bool /*hidden*/) noexcept { +} + +}; } // namespace Microsoft::ReactNative From 726d469b056dcdd9f4b9813c18883fa0757fbbdc Mon Sep 17 00:00:00 2001 From: Andrew Coates <30809111+acoates-ms@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:44:41 -0700 Subject: [PATCH 2/4] format --- .../Modules/StatusBarManager.h | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h b/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h index 1cb994b89a6..cf69d0f04bc 100644 --- a/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h +++ b/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h @@ -10,30 +10,25 @@ namespace Microsoft::ReactNative { REACT_MODULE(StatusBarManager) struct StatusBarManager { -using ModuleSpec = Microsoft::ReactNativeSpecs::StatusBarManagerAndroidSpec; + using ModuleSpec = Microsoft::ReactNativeSpecs::StatusBarManagerAndroidSpec; -REACT_GET_CONSTANTS(GetConstants) -static Microsoft::ReactNativeSpecs::StatusBarManagerAndroidSpec_Constants GetConstants() noexcept { - //return {{"HEIGHT", 0}, {"DEFAULT_BACKGROUND_COLOR": 0}}; + REACT_GET_CONSTANTS(GetConstants) + static Microsoft::ReactNativeSpecs::StatusBarManagerAndroidSpec_Constants GetConstants() noexcept { + // return {{"HEIGHT", 0}, {"DEFAULT_BACKGROUND_COLOR": 0}}; return {0}; -} - -REACT_METHOD(setColor) -static void setColor(double /*color*/, bool /*animated*/) noexcept { -} + } -REACT_METHOD(setTranslucent) -static void setTranslucent(bool /*translucent*/) noexcept { -} + REACT_METHOD(setColor) + static void setColor(double /*color*/, bool /*animated*/) noexcept {} -REACT_METHOD(setStyle) -static void setStyle(std::optional /*statusBarStyle*/) noexcept { -} + REACT_METHOD(setTranslucent) + static void setTranslucent(bool /*translucent*/) noexcept {} -REACT_METHOD(setHidden) -static void setHidden(bool /*hidden*/) noexcept { -} + REACT_METHOD(setStyle) + static void setStyle(std::optional /*statusBarStyle*/) noexcept {} + REACT_METHOD(setHidden) + static void setHidden(bool /*hidden*/) noexcept {} }; } // namespace Microsoft::ReactNative From c680769d96adbdeca44b6679afc33a868e164cb3 Mon Sep 17 00:00:00 2001 From: Andrew Coates <30809111+acoates-ms@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:44:52 -0700 Subject: [PATCH 3/4] Change files --- ...ative-windows-bc48bd5b-3e22-40db-8384-1b2da3d2d09f.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-bc48bd5b-3e22-40db-8384-1b2da3d2d09f.json diff --git a/change/react-native-windows-bc48bd5b-3e22-40db-8384-1b2da3d2d09f.json b/change/react-native-windows-bc48bd5b-3e22-40db-8384-1b2da3d2d09f.json new file mode 100644 index 00000000000..6590e8cea99 --- /dev/null +++ b/change/react-native-windows-bc48bd5b-3e22-40db-8384-1b2da3d2d09f.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Enforce StatusBarManger module aligns with Spec", + "packageName": "react-native-windows", + "email": "30809111+acoates-ms@users.noreply.github.com", + "dependentChangeType": "patch" +} From 8391ec56c1d4cff3e6f62f579554bc253067b501 Mon Sep 17 00:00:00 2001 From: Andrew Coates <30809111+acoates-ms@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:48:06 -0700 Subject: [PATCH 4/4] fix --- vnext/Microsoft.ReactNative/Modules/StatusBarManager.h | 1 - 1 file changed, 1 deletion(-) diff --git a/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h b/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h index cf69d0f04bc..eca1b9a5b04 100644 --- a/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h +++ b/vnext/Microsoft.ReactNative/Modules/StatusBarManager.h @@ -14,7 +14,6 @@ struct StatusBarManager { REACT_GET_CONSTANTS(GetConstants) static Microsoft::ReactNativeSpecs::StatusBarManagerAndroidSpec_Constants GetConstants() noexcept { - // return {{"HEIGHT", 0}, {"DEFAULT_BACKGROUND_COLOR": 0}}; return {0}; }