Skip to content

Commit

Permalink
Fixes bug introduced by pointerEvents change (#10498)
Browse files Browse the repository at this point in the history
* Fixes bug introduced by pointerEvents change

The handling for pointerEvents moved from ViewViewManager to ViewManagerBase so all views could participate in pointerEvents handling (including Text, etc.). During this move, the code introduced a bug where updates to pointerEvents after pointerEvents is set to `none` are not respected.

This adds an else clause to ensure we reset the `IsHitTestVisible` property when a the `pointerEvents` value is not `none`, but still valid.

Resolves #10493

* Change files
  • Loading branch information
rozele authored and acoates-ms committed Sep 6, 2022
1 parent 6703c83 commit cdf3ee1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Fixes bug introduced by pointerEvents change",
"packageName": "react-native-windows",
"email": "ericroz@fb.com",
"dependentChangeType": "patch"
}
6 changes: 4 additions & 2 deletions vnext/Microsoft.ReactNative/Views/ViewManagerBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,11 @@ bool ViewManagerBase::UpdateProperty(
const auto iter = pointerEventsMap.find(propertyValue.AsString());
if (iter != pointerEventsMap.end()) {
nodeToUpdate->m_pointerEvents = iter->second;
if (nodeToUpdate->m_pointerEvents == PointerEventsKind::None) {
if (const auto uiElement = nodeToUpdate->GetView().try_as<xaml::UIElement>()) {
if (const auto uiElement = nodeToUpdate->GetView().try_as<xaml::UIElement>()) {
if (nodeToUpdate->m_pointerEvents == PointerEventsKind::None) {
uiElement.IsHitTestVisible(false);
} else {
uiElement.ClearValue(xaml::UIElement::IsHitTestVisibleProperty());
}
}
} else {
Expand Down

0 comments on commit cdf3ee1

Please sign in to comment.