Summary: Changing AppContainer to render a wrapper component in it, if it exists. This wrapper is NOT a required property of AppContainer. Now, app-wide properties can be passed down via context to the container's children.
Reviewed By: sahrens, fkgozali
Differential Revision: D5283895
fbshipit-source-id: 8595e22c4b5ebf5d0e57f358152fba8a80cb2723
Summary:
react@16 (a peerDependency) did away with the PropTypes export in favor of the prop-types module.
This updates all of the remaining references to `React.PropTypes`.
Closes https://github.com/facebook/react-native/pull/14641
Differential Revision: D5287167
Pulled By: javache
fbshipit-source-id: a917e29aa0e5470260568995dfe97f5528ec265e
Summary:
RCTRootView supports a property `passThroughTouches` which when set, allows
touches to propagate to sibling views. To allow touches to reach RCTRootView,
we also need to set `pointerEvents` on the RCTViews wrapping the child views.
Reviewed By: javache
Differential Revision: D4385443
fbshipit-source-id: 6291d8614870168f1c4cdf0ef5ff6e42e4a8ef63
Summary:
Following up on fb7fe2d4e8: when <Modal> is used in dev mode, it renders `<AppContainer>` to wrap the children so that the element inspector can show up correctly. In that scenario, we need pass the `rootTag` over the `<AppContainer>` so that the children can read the rootTag correctly. Otherwise, the children of <Modal> will see it as undefined.
With this, AppContainer can then declare `rootTag` as a required prop, as it should have been.
Note that this only affects DEV build because there's no AppContainer wrapping otherwise.
Reviewed By: jingc
Differential Revision: D4204011
fbshipit-source-id: 80edbc8d351d983786e6fc3c68dfa65a71b1ed3c
Summary:
This does 2 things:
- modernize the component to use ES6 + flow
- assign `rootTag` to the child context
Each view in RN has its own `reactTag`. The reactTag for a root view is called `rootTag`. When there are multiple react root views active within the app (e.g. in a hybrid environment), rootTag is the only reliable "label" to differentiate them. This is especially useful when we want to limit an event/activity on a particular root view, instead of affecting all active root views. This allows components to do:
```
class Foo extends React.Component {
static contextTypes = {
rootTag: React.PropTypes.number,
};
componentDidMount() {
// Get the root tag of this component, which is static for all components under the same root view
console.log(this.context.rootTag);
}
}
```
In a pure JS RN app environment, there will always be exactly 1 root view, so `rootTag` may usually be ignored.
Reviewed By: yungsters
Differential Revision: D4130376
fbshipit-source-id: 559b67615f487bad754b5832ad4a02bcef05be2a