From 7c15f835724fad7edff81314321d9d79543e8a5f Mon Sep 17 00:00:00 2001 From: Ken Anderson Date: Mon, 11 Nov 2019 10:59:00 -0800 Subject: [PATCH 1/3] Workaround for flyout centering problem --- vnext/ReactUWP/Views/FlyoutViewManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vnext/ReactUWP/Views/FlyoutViewManager.cpp b/vnext/ReactUWP/Views/FlyoutViewManager.cpp index e29ed8bef0c..020c2dfa765 100644 --- a/vnext/ReactUWP/Views/FlyoutViewManager.cpp +++ b/vnext/ReactUWP/Views/FlyoutViewManager.cpp @@ -122,6 +122,11 @@ void FlyoutShadowNode::AddView(ShadowNode &child, int64_t index) { if (m_flyout != nullptr) { m_flyout.Content(childView.as()); + if (winrt::FlyoutPlacementMode::Full == m_flyout.Placement()) { + if (auto fe = m_flyout.Content().try_as()) { + AdjustDefaultFlyoutStyle((float)fe.Width(), (float)fe.Height()); + } + } } } From b0defe86c05d88310fb66663be45dd925d3b3207 Mon Sep 17 00:00:00 2001 From: Ken Anderson Date: Mon, 11 Nov 2019 12:52:04 -0800 Subject: [PATCH 2/3] adding comment explaining fix --- vnext/ReactUWP/Views/FlyoutViewManager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vnext/ReactUWP/Views/FlyoutViewManager.cpp b/vnext/ReactUWP/Views/FlyoutViewManager.cpp index 020c2dfa765..cee29d1b14c 100644 --- a/vnext/ReactUWP/Views/FlyoutViewManager.cpp +++ b/vnext/ReactUWP/Views/FlyoutViewManager.cpp @@ -123,6 +123,12 @@ void FlyoutShadowNode::AddView(ShadowNode &child, int64_t index) { if (m_flyout != nullptr) { m_flyout.Content(childView.as()); if (winrt::FlyoutPlacementMode::Full == m_flyout.Placement()) { + // When using FlyoutPlacementMode::Full on a Flyout with an embedded + // Picker, the flyout is not centered correctly. Below is a temporary + // workaround that resolves the problem for flyouts with fixed size + // content by adjusting the flyout presenter max size settings prior to + // layout. This will unblock those scenarios while the work on a more + // exhaustive fix proceeds. Tracked by Issue #2969 if (auto fe = m_flyout.Content().try_as()) { AdjustDefaultFlyoutStyle((float)fe.Width(), (float)fe.Height()); } From 23ac05f7604f58c93a6debd9466a06eec8f0e590 Mon Sep 17 00:00:00 2001 From: Ken Anderson Date: Mon, 11 Nov 2019 12:58:16 -0800 Subject: [PATCH 3/3] Change files --- ...2019-11-11-12-58-16-flyout-centering-workaround.2.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 change/react-native-windows-2019-11-11-12-58-16-flyout-centering-workaround.2.json diff --git a/change/react-native-windows-2019-11-11-12-58-16-flyout-centering-workaround.2.json b/change/react-native-windows-2019-11-11-12-58-16-flyout-centering-workaround.2.json new file mode 100644 index 00000000000..fff54a6125b --- /dev/null +++ b/change/react-native-windows-2019-11-11-12-58-16-flyout-centering-workaround.2.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "Workaround for flyout centering problem", + "packageName": "react-native-windows", + "email": "kenander@microsoft.com", + "commit": "b0defe86c05d88310fb66663be45dd925d3b3207", + "date": "2019-11-11T20:58:16.583Z" +} \ No newline at end of file