Skip to content

Commit

Permalink
Fix UIManagerBinding's findNodeAtPoint (#42439)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #42439

UIManagerBinding's findNodeAtPoint assumes that UIManager::findNodeAtPoint returns non-null pointers. But, this is false! See [LayoutableShadowNode::findNodeAtPoint](https://github.com/facebook/react-native/blob/fd0ca4dd6209d79ac8c93dbffac2e3dca1caeadc/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp#L333-L354):

https://www.internalfb.com/code/fbsource/[7169da7945c813b35cd0a4fa15e66969c90c2481]/xplat/js/react-native-github/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp?lines=333%2C354

Changelog: [General][Fixed] Fix UIManagerBinding's findNodeAtPoint

Reviewed By: cortinico, sammy-SC

Differential Revision: D52909512

fbshipit-source-id: e1da112d4f8dcf4cdc037c978d84751eb8cf6695
  • Loading branch information
RSNara authored and facebook-github-bot committed Jan 26, 2024
1 parent d11dca7 commit 62e5980
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ jsi::Value UIManagerBinding::get(
arguments[3].getObject(runtime).getFunction(runtime);
auto targetNode =
uiManager->findNodeAtPoint(node, Point{locationX, locationY});

if (!targetNode) {
onSuccessFunction.call(runtime, jsi::Value::null());
return jsi::Value::undefined();
}

auto& eventTarget = targetNode->getEventEmitter()->eventTarget_;

EventEmitter::DispatchMutex().lock();
Expand Down

0 comments on commit 62e5980

Please sign in to comment.