react-native/Examples
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
..
2048 Changed JS location of examples to source from RCTBundleURLProvider instead. 2016-07-15 10:13:29 -07:00
Movies Convert from React.createClass to ES6 classes 2016-07-26 01:13:31 -07:00
TicTacToe Convert from React.createClass to ES6 classes 2016-07-26 01:13:31 -07:00
UIExplorer Adds the ability to use UIManager to check if a node is an ancestor 2016-08-03 04:13:43 -07:00
.eslintrc Add global flow types to eslint globals 2016-01-27 15:55:34 -08:00