setTabButton to change the label of the TabButton (#2215)
* setTabButton -> has now the property 'label' to change the label of the TabButton
* Add to documentation
* [BugFix] use i instead of 0 to check all TabItems
Add the preview and pop feature
To use the feature you simply call `navigator.push()` but with additional parameter `previewViewID` which is a React Node.
```js
<TouchableOpacity
onPressIn={() => this.props.navigator.push({
screen: 'screenid',
previewView: this.viewRef,
previewActions: [{
title: 'Foo',
style: 'selected', // none, selected, destructive
actions: [{ title: 'Bar' }],
}],
})
/>
```
This commit saves navBar component props in propsRegistry and restores the saved props
when the component is mounted, allowing us to pass unserializable props to custom navBar component.
(Android) Allow disableOpenGesture right or left in the drawer (#2189)
This pull request allows you to disable the open gesture only in one side of the drawer.
```
Navigation.startSingleScreenApp({
screen: initialScreen,
drawer: {
left: {
screen: DRAWER_SCREEN,
disableOpenGesture: false,
},
right: {
screen: SIDEBAR_FILTER_SCREEN,
disableOpenGesture: true,
},
},
});
```
If we pass disableOpenGesture to the drawer root object, like this:
```
Navigation.startSingleScreenApp({
screen: initialScreen,
drawer: {
left: {
screen: DRAWER_SCREEN,
disableOpenGesture: false,
},
right: {
screen: SIDEBAR_FILTER_SCREEN,
disableOpenGesture: true,
},
disableOpenGesture: true <======
},
});
```
Then the two drawer positions would be gesture disabled and the specific disableOpenGesture would be ignored. This way we don`t introduce breaking changes.
Support passing unserializable props to custom button (#2192)
This commit applies the save props mechanism used when pushing screen
to navigator buttons as well, enabling us to pass unserializable props to buttons.
This commit adds ability to register multiple navigator event listeners:
navigator.addOnNavigatorEvent(func)
navigator.removeOnNavigatorEvent(func)
Event listeners are removed when the screen the navigator is bound to
is unmounted, calling `removeOnNavigatorEvent` isn't mandatory.
As this api conflicts with the current api, addOnNavigatorEvent can't be used
in a screen where setOnNavigatorEvent was used before.
Finish SplashActivity if it's opened over NavigationActivity
On some devices, when returning to the app from background, some launchers
open the SplashActivity over the NavigationActivity. In this case, simply finish the SplashActivity
and return the the preview NavigationActivity.
No major changes, just tweaked values a little bit.
* Fab animation duration changed to 120 (previously 200)
* Fab show animation: Scales from 0.6 to 1 (previously 0)
* Fab hide animation: Scales from 1 to 0.6 (previously 0)
* Removed alpha delay from screen animation
* TranslationY value changed from 8% to 5%
* Support showing modals with the default screen push/pop animation
* Set navigation bar color before modal is displayed
* Implement screenAnimationType property
controls animation type of all screens including modals.
When toggleTabs was called, the visibility state of the BottomTabs
was not persisted. There for, when pushing a screen and popping
the BottomTabs visibility state was set to the value of bottomTabsHidden
from navigatorStyle.
This commit continues the work done in #2057.
When hardware back button is pressed, we handle it accordingly:
1. If screen was pushed with `overrideBackPress: true`, we emit `backPress` event
2. Let `BackHandler` handle the event
3. If the event wasn't handled by `BackHandler`, pop the stack
4. let the system handle the event
Revert "fix issues with Android BackHandler listeners not getting called, not allowing to override the back functionality from the JS side (#2057)" (#2060)