(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 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.
Until now, buttons would use the same font family used by the title,
this commit introduces navBarButtonFontFamily property which allows to set
a different font family for title and buttons.
Support subtitle FontFamily on size on Android (#2036)
* Support subtitle FontFamily on size on Android
Font family can be either a .ttf/.otf asset or one of the default font families:
* sans-serif (regular)
* sans-serif-light
* sans-serif-condensed
* sans-serif-thin
* sans-serif-medium
* update docs
This commit adds support for fade and slide-horizontal animations for modals and a few other animation related changes:
* Support defining animationType when calling dismissModal
* Support fade and slide horizontal animations for modals
* Slightly reworked current screen animations timings
* Fixed slide-horizontal x offset and removed alpha
* added method for getting the currently visible screen ID. Can be useful to decide if logic should be applied according to screen visibility, for example: set buttons/title dynamically, or even determine that you don’t need to show the same screen again if it’s the current one that’s showing
* Implement getCurrentlyVisibleScreenId on Android
Can be used statically:
Navigation.getCurrentlyVisibleScreenId() - returns the unique screen
instance id
With a navigator instance:
await this.props.navigator.screenIsCurrentlyVisible() - resolves a
promise that checks if the current screen is visible
* Add screen visibility listener which can be registered globally
API
new ScreenVisibilityListener({
willAppear: ({screen, timestamp}) => console.log(`Displaying screen ${screen}`),
didAppear: ({screen, timestamp}) => console.log(`Screen ${screen} displayed in ${Date.now() - timestamp} millis`)
}).register();
todo
* Add timestamp to modal, resetTo
* implement unregister
* implement iOS
* Add global screen visibility listener to example app
* Think I better assign a value to emitter
* Send timestamp in resetTo
* Moved listener to library, it can be deleted from the app
* Add push and resetTo buttons to pushed screens
* Send appear/disappear events after animation ends
* Pass pop timestamp from js
* Send timestamp in popToRoot
* Add popToRoot button in push screen
* Add few navigation buttons to modal screen
* Pass timestamp to tabs
relevant only to first/initial tab
* Update timestamp when navigating between BottomTabs
* Send screen visible events after modal dismiss
* log willDisappear and didDisappear
* Report both start and end timestamps
* Implement unregister
* Send NavigationType parameter in visibilityEvent
This indicates the type of the navigation command that triggered the visibility change
* Rename pushInitialScreen to more explicit name
* Fix duplicate initialScreen visibility events
* Update screen visibility log statement
* Show popToRoot in modal screen only if screens were pushed
* implement global screen event for iOS
* fix lint issues
Add font size support on title bar for android (#1493)
* Add font family support on bottom tabs
* import missing classes
* import missing class
* update document
* Support customize icon for left nav button in android
* Add navBar navBarTextFontSize support for android
Currently startApp is called from global context which results in the
app being launched when headlessJs tasks run in the background.
In order to support this use case, while not breaking existing users,
this commit adds two mechanisms which should help users detrmine if
the native Activity is running and startApp can be called safely.
1. RNN.appLaunched event is emitted is SplashActivity starts and react
context has already been created. This is the use case of openeing
the app while headless js task was started or has just finished and
react context is in a "pasued" state.
2. Navigation.isAppLaunched() convenience method has been added.
It returns a promise which when resolved, indicates if the app
is launched and we should show the ui or not.
Usage
import {Navigation, NativeEventsReceiver} from 'react-native-navigation';
Promise.resolve(Navigation.isAppLaunched())
.then(appLaunched => {
if (appLaunched) {
startApp();
} else {
new NativeEventsReceiver().appLaunched(startApp);
}
});
function startApp() {
Navigation.startTabBasedApp({ ... });
}
Support centering title and changing its font on Android
This commit adds support for the following style properties:
titleBarTitleFontFamily - string, font name in assets
titleBarTitleTextCentered - boolean, default is false
* Add view manager
* Don’t update screen style on ViewPagerScreenChangedEvent
* change version to legacy
* Fix headers after rebase
* version bump
* Add image to each list item
* Basics structure is done (I think)
toElement also animates into place, even though values are completely wrong.
* Stop relying on refs to resolve fromElements
* Hide only corresponding fromElement
* Animate sharedElements back into place on screen pop
* Update example project with Dota heroes
* Initial curved animation implementation
* Stop resolving sharedElement refs
* Move getLocationOnScreen to ViewUtils
* Parse control points passed from Js
* Scale animation works
Not sure about pivot coordinates yet.
* minor update to SharedElementsTransition screen
* Minor changes to example screens
* Draw shared elements on Screen
Ignore Z order and draw shared elements directly on screen
* stuff
* Start animation after views are drawn
* f
* Animate text color
* Less allocations when animating text color
* Switch from RGB to LAB 😎
* Save and restore SpannedString
* Use correct status bar height in Android M
* Pass show and hide duration from Js
* Fix flicker when show animation starts
* Make shared elements not clickable
motivation: might be related to some native crash
* Use linear interpolation as default interpolation
* Code cleanup
* Clear SharedElements refs when screen is destroyed
* Code cleanup
* Add decelerate interpolator
* No more occasional flicker on animation start (Hopefully 🙏)
* Add FastOutSlowIn interpolator
* Animate only visible shared elements
* Clip bounds animator somewhat works
* Hope fully no more flickery images
* Add interpolator to each animator
* some work on shared element screens
* rebase fix
* fix lint