This resolves an issue where currentTabIndex, for example, was not cleared properly
if it was set in initialOptions as it was cloned each time clearOptions was invoked.
[BREAKING] Call Navigation.events().bindComponent(this) to listen to lifecycle events
This commit introduces breaking changes to the way components listen to RNN events.
Background
Up until now, components could handle navigation events by implemented a set of callbacks:
* componentDidAppear
* componentDidDisappear
* onNavigationButtonPressed
* onSearchBarUpdated
* onSearchBarCancelPressed
While this worked fine for the most part, this was completely broken for HOCs as RNN invoked these methods only on the registered component (top most HOC), leaving it to the user to propagate these events down the HOC chain. See the discussion in #1642 for more details.
Solution
In order to support HOC use case, we're introducing a new api which will let any Component bind itself to receive navigation events:
```js
class LifecycleScreen extends Component {
constructor(props) {
super(props);
this.subscription = Navigation.events().bindComponent(this);
}
componentWillUnmount() {
// The subscription is removed automatically when components unmount, but they can be explicitly removed as well by calling `this.subscription.remove(); `
}
}
```
It's still the users responsibility to propagate the `componentId` down the HOC chain, but by binding a component to RNN, it will be able to handle events as expected. Multiple components can be bound for the same `componentId`.
Consolidate event names
* onNavigationButtonPressed -> navigationButtonPressed
* onSearchBarUpdated -> searchBarUpdated
* onSearchBarCancelPressed -> searchBarCancelPressed
Merge default options before resolving animation options
Command animations did not take default options into account when resolving animation options.
This commit fixes that, TopBar options still need to be addressed.
This commit introduces an option to control the way components are pushed into the stack.
When pushing components into a stack, they are pushed the moment they are measured.
If `waitForRender` is true, components will be pushed only after the initial render.
api:
```js
options: {
animations: {
push: {
waitForRender: true
},
showModal: {
waitForRender: true
}
}
}
```
Unmount react views when bundle load completes (#3487)
Unmount react views when bundle load completes
Users providing their own ReactNativeHost implementations should implement BundleDownloadListenerProvider
and make sure they set DevBundleDownloadListener when ReactInstanceManager.
I was unable to compile because I use multidex and this line of code force the multidex library to be version 25.4.0 when the latest for this one is 1.0.3. This little fix may save a lot headaches.