react-native/React
alvaromb e52cab5a7f Adds the ability to use UIManager to check if a node is an ancestor
Summary:
Sometimes is handy to check if a React node is a descendant of another node or not. For instance, I want to check if the focused `TextInput` is descendant of an specific `ScrollView`:

```js
const currentlyFocusedField = TextInput.State.currentlyFocusedField()
UIManager.viewIsAncestorOf(
  currentlyFocusedField,
  this.getInnerViewNode(),
  (isAncestor) => {
    if (isAncestor) {
      console.log('The focused field is a descendant of this ScrollView!')
    }
  }
)
```

This function uses the same strategy as the `measureLayout` method to check if one node is an ancestor of other node. As the `measureLayout` method, this is performed outside the main thread.

By now I've only implemented the iOS version and its tests, but if this function is going to be merged I'll implement the Android version too. I have objc experience but no Java or Android, so I prefer to validate this functionality before jumping into developing the Android part.
Closes https://github.com/facebook/react-native/pull/7876

Differential Revision: D3662045

Pulled By: javache

fbshipit-source-id: b9668e8ea94fd01db76651f16243926cf9c2566f
2016-08-03 04:13:43 -07:00
..
Base Reverted commit D3580025 2016-08-02 14:13:27 -07:00
CSSLayout Dont redefine abort() as it may leak into other files 2016-08-03 01:58:39 -07:00
Executors Use new enqueueJSCall method everywhere 2016-08-02 11:14:06 -07:00
Modules Adds the ability to use UIManager to check if a node is an ancestor 2016-08-03 04:13:43 -07:00
Profiler Add more profiling markers to RCTJSCExecutor 2016-07-19 07:28:34 -07:00
React.xcodeproj Handle children internally in CSSLayout 2016-07-20 13:28:30 -07:00
Views Adds the ability to use UIManager to check if a node is an ancestor 2016-08-03 04:13:43 -07:00