[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
* V2: Peek and pop
* Add event when preview is dismissed in non commit mode
* tslint
* Refactor playground. Document preview api
* Added width prop
* Implement hybrid push/preview button
* Fixing small linting errors
* Work in progress
* Arbitary changes
* Improvements on API
* Cleanup RNNSplitViewController, allow mergeOptions
* Added documentation and better playground example
* Adding tests for coverage
* Find out why this test is failing.
* Only show split view on iOS
* Add test back in
* setRoot({root:{}})
* support setRoot with root, modals, overlays
* Update setRoot calls in playground app to new api
* Update setRoot on Android to new api
currently only supporting root node
* Update setRoot on iOS to new api
* fix unit tests
[Experimental] Custom transition animation for ios (#1955)
* screen Background Color iOS
* ios v2 topBarTextFontFamily
* added topBarHidden to iOS
* minor fix and topBarHideOnScroll
* minor fix
* topBarButtonColor iOS
* topBarTranslucent iOS
* topBarTranslucent IOS minor fixes
* eslint fixes
* minor fixes
* changed setTabBadge to tabBadge and added a unit test in iOS
* added fontSize on iOS
* minor fix
* topBarTransparent
* minor fix
* first dirty custom transition iOS poc. in need of complete refactor and testing
* dirty poc for view transition
* dirty poc of interactive transition
* deleted unNeeded Files
* cleaning
* cleaning, support for interactiveImagePop and backButton custom transition
* cleaning
* merge v2 into custom-transition-animation fix
* merge fix
* merge fix
* cleaning and merge fix
* support for multiple animation in parralel, animations with are not shared element including: velocity, spring, alpha and translate
* last commit should also include these
* added resize mode animation and fixed flickering bug
* refactoring
* first cleaning and another test
* cleaning
* commandsHandler now accepts bridge in constructor, fixed tests, added e2e test
* eslint
* android pop now recieves two parameters - preparation for custom transition
* Refactor + add afterLoad to modal
* merge v2 second try
* merge fix
* merge fix
* fix ios unit tests
* fixed topBarTransparent e2e
* fix js tests
* refactored RNNAnimator, RNNAnimatedView, small fixes
* refactor topBarLargeTitle
* fixed lifycycle bug with componentWillUnmount, small fixes
* fix transparent conflict
* removered Element.js from coverage report
* comment redundent test
(still needs to be discussed), small fix
* removed commented test, moved element.js to adapters