Fix UIManagerBinding's findNodeAtPoint (#42439)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Ramanpreet Nara
2024-01-25 16:56:49 -08:00
committed by Facebook GitHub Bot
parent d11dca7ba3
commit 62e5980954
@@ -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();