Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning up XAML Flyout when shadow node view is dropped. #2564

Merged
merged 1 commit into from
Jun 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion vnext/ReactUWP/Views/FlyoutViewManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class FlyoutShadowNode : public ShadowNodeBase
void AddView(ShadowNode& child, int64_t index) override;
void createView() override;
static void OnFlyoutClosed(IReactInstance& instance, int64_t tag, bool newValue);
void onDropViewInstance() override;
void removeAllChildren() override;
void updateProperties(const folly::dynamic&& props) override;

Expand Down Expand Up @@ -138,7 +139,7 @@ void FlyoutShadowNode::createView()
m_flyout.Closing([=](winrt::FlyoutBase /*flyoutbase*/, winrt::FlyoutBaseClosingEventArgs args)
{
auto instance = wkinstance.lock();
if (!m_updating && instance != nullptr && !m_isLightDismissEnabled && m_flyout.IsOpen())
if (!m_updating && instance != nullptr && !m_isLightDismissEnabled && m_isOpen)
{
args.Cancel(true);
}
Expand All @@ -158,6 +159,11 @@ void FlyoutShadowNode::createView()
instance.DispatchEvent(tag, "topDismiss", std::move(eventData));
}

void FlyoutShadowNode::onDropViewInstance() {
m_isOpen = false;
m_flyout.Hide();
}

void FlyoutShadowNode::removeAllChildren()
{
m_flyout.ClearValue(winrt::Flyout::ContentProperty());
Expand Down