mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-30 22:12:42 +08:00
Add viewIsDescendantOf for UIManager on Android
Summary: Add the ability for UIManager to check if a node is an ancestor of anther one on Android like #7876 did on iOS Closes https://github.com/facebook/react-native/pull/13129 Differential Revision: D4938319 Pulled By: hramos fbshipit-source-id: abe20779be2142a1ea9ac46f52d8cd8609236419
This commit is contained in:
committed by
Facebook Github Bot
parent
2d1c721fd6
commit
663df57c62
@@ -469,6 +469,22 @@ public class UIImplementation {
|
||||
mOperationsQueue.enqueueFindTargetForTouch(reactTag, targetX, targetY, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the first shadow node is the descendant of the second shadow node
|
||||
*/
|
||||
public void viewIsDescendantOf(
|
||||
final int reactTag,
|
||||
final int ancestorReactTag,
|
||||
final Callback callback) {
|
||||
ReactShadowNode node = mShadowNodeRegistry.getNode(reactTag);
|
||||
ReactShadowNode ancestorNode = mShadowNodeRegistry.getNode(ancestorReactTag);
|
||||
if (node == null || ancestorNode == null) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
callback.invoke(node.isDescendantOf(ancestorNode));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the location on screen, width, and height of the given view relative to the root
|
||||
* view and returns the values via an async callback.
|
||||
|
||||
Reference in New Issue
Block a user