Skip to content

Commit

Permalink
Fix keyboard event unsubscribe (#11057)
Browse files Browse the repository at this point in the history
* Fix keyboard event unsubscribe

Boolean check was flipped for keyboard event handler. Likely no behavior
change, since often ReactRootView is destroyed (along with the
shared_ptr for keyboard event handler) shortly after UninitRootView is
called.

* Change files
  • Loading branch information
rozele committed Jan 9, 2023
1 parent 39d70cf commit 5b40a3d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Fix keyboard event unsubscribe",
"packageName": "react-native-windows",
"email": "erozell@outlook.com",
"dependentChangeType": "patch"
}
4 changes: 2 additions & 2 deletions vnext/Microsoft.ReactNative/ReactRootView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ void ReactRootView::UninitRootView() noexcept {
}
}

if (m_touchEventHandler != nullptr) {
if (m_touchEventHandler) {
m_touchEventHandler->RemoveTouchHandlers();
}

if (!m_previewKeyboardEventHandlerOnRoot) {
if (m_previewKeyboardEventHandlerOnRoot) {
m_previewKeyboardEventHandlerOnRoot->unhook();
}

Expand Down

0 comments on commit 5b40a3d

Please sign in to comment.