This commit fixes issues with BottomTabs text color on iOS 13
* Extract bottomTab options from base presenter
* Add iOS 13 appearance support for bottomTabs and bottomTab
Merge v5 into master
Highlights of this release
* Easier installation
* autolink and reac-native link support
* Shared Element Transition - reimplemented from scratch and new API
* [iOS] showModal animation api parity
* [Android] Animation values are now declared in dp
* [iOS] deprecate topBar.drawBehind
* [Android] RNN is migrating to Kotlin
closes #5904
Move all topBar.title options to topBarTitlePresenter (#5883)
Fix TopBar title animation. This commit changes how RNN handles title and subtitle.
Until now, RNN created a custom view for title and subtitle which interfered with the way the system animated the TopBar title.
With this commit the custom view is created only when both subtitle and title are declared, otherwise RNN uses the system behavior.
Send componentType field in componentDidAppear and componentDidDisappear events.
The new field is either:
- TopBarButton
- TopBarTitle
- TopBarBackground
- Component
Add iOS support for `bottomTabs.attachMode`.
This property controls when BottomTabs children are attached to hierarchy and when their React views are created.
By default, RNN attaches all children at the same time which might impact loading time as a few screens are instantiated at once.
Using `afterInitialTab` or `onSwitchToTab` generally leads to improved start up time.
Fix default modalPresentationStyle on iOS 13 (#5709)
* Set as default modalPresentationStyle
* Sets the system default modalPresentationStyle
* Fix tests
* Fix unit tests
* Fix unit tests
* Add modal.swipeToDismiss option
Prevent creation of button react view with the same componentId (#5687)
When updating buttons with mergeOptions, existing custom buttons are unmounted and then recreated. This commit adds an optimisation which prevents the react components from being recreated.
To avoid unnecessary recreation, add an `id` to the component. If an existing react view is found for that id, it will be reused.
Remove component if title is defined in mergeOptions (#5634)
When mergeOptions was called without a title component, existing component was undesirably removed.
This commit changes how component is removed when mergeOptions is called. It will now be removed if a component is not defined and title is defined in mergeOptions.
Fixes #5628
Break all the PRs :(
iOS and Android code base used different naming conventions - this commit aims to unify naming conventions. I probably missed a few properties here and there so this will be an ongoing effort.
This commit adds initial support for passing null as a valid value for color properties.
When a color property is applied, if it wasn't specified then the default color is applied. Now, when null is passed, no color will be applied
leaving the last color applied as is.
This is useful when showing an Overlay and you'd like to keep the current StatusBar color unaffected. Another usecase would be when you'd like to avoid coloring an icon in BottomTabs.
# Changes
* Support RN 0.60
* Migrate to AndroidX
* Improve draw behind StatusBar (Preparation for #4258)
* Don't push BottomTabs when keyboard is displayed (Fixes #4005, #3424)
- It won't be needed to toggle the BottomTabs when Keyboard is visible
* BottomTab badge and dot indicator are not animated by default on Android (parity with iOS)
# Updating from v2
v3 is currently in alpha. To update simply npm install `3.0.0-alpha.11` - `npm install --save react-native-navigation@3.0.0-alpha.11`.
Breaking changes are outlined below.
## Layout system changes on **Android**
* Parent layouts (BottomsTabs, Stack, SideMenu) are always laid out behind the StatusBar.
* Components (`component` and `externalComponent`) are measured and offset according to the StatusBar.
In this release, We're changing the layout system in order to provide better support for immersive and full screen apps. In this release we've improved support for drawing behind the StatusBar, next we'll address drawing behind the NavigationBar.
Use the `drawBehind` and `translucent` options to control the StatusBar
```js
statusBar: {
drawBehind: true, // will draw a screen behind the StatusBar
translucent: true // Usually you'll want to have drawBehind: true when this is true
}
```
While this isn't a breaking API change - there are a few breaking side effects.
### How will my app be effected
1. When the keyboard is opened, BottomTabs will now be drawn behind the keyboard and won't shift upwards. This is in parity with the current behaviour in iOS. For the most part, this isn't a breaking change. Toggling BottomTabs when TextInput's focus changes won't be needed anymore.
2. While parent controllers are drawn behind the StatusBar, their background isn't.
This means that when transitioning from a destinations drawn under the StatusBar to a destination drawn behind it, the application's default background color will be visible behind the StatusBar.
If you application's theme is dark, you might want to change the `windowBackground` property to mitigate this:
Add the following to your application's `style.xml`
```xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@color/backgroundColor</item>
</style>
<!--This is your application's default background color.
It will be visible when the app is first opened (while the splash layout is visible)
and when transitioning between a destination a screen drawn under the StatusBar to
a destination drawn behind it-->
<item name="backgroundColor" type="color">#f00</item>
</resources>
```
## AndroidX migration
We've migrated RNN to AndroidX, please follow migration instructions in the react-native repo.
## Removed SyncUiImplementation
[SyncUiImplementation](https://github.com/wix/react-native-navigation/blob/master/lib/android/app/src/reactNative57WixFork/java/com/reactnativenavigation/react/SyncUiImplementation.java) was used to overcome a bug in RN's UiImplementation. This workaround was added to RN's `UiImplementation` in RN 0.60 (thanks @SudoPlz) and can be removed from RNN.
If you're using `SyncUiImplementation` your app will fail to compile after upgrading to v3. Simply remove the following code from your `MainApplication.java`
```diff
- import com.facebook.react.uimanager.UIImplementationProvider;
- import com.reactnativenavigation.react.SyncUiImplementation;
- @Override
- protected UIImplementationProvider getUIImplementationProvider() {
- return new SyncUiImplementation.Provider();
- }
```
## BottomTab badge and dot indicator are not animated by default on Android (parity with iOS)
Showing and hiding badge and dot indicator are now not animated by default. Badge animation is now controlled with the `bottomTab.animateBadge` property and dot indicator with `bottomTab.dotIndicator.animate` property.
#### The following option will show a badge with animation
```js
bottomTab: {
badge: 'new,
animateBadge: true
}
```
#### The following option will show a dot indicator with animation
```js
bottomTab: {
dotIndicator: {
visible: true,
animate: true
}
}
```
closes #5228
Delete code related to old SideMenu implementation (#5254)
V1 had two SideMenu implementations. In v2 we've decided to stick with one and for some reason
code related to the unsupported implementation was left in the project.
* Support RN 0.59
* Fix yellow box detection on Android
* Manually link jsc on iOS in playground app
* Fix android unit tests
* Add JavaScriptCore.framework to iOS unit tests
* Download licenses before unit and e2e tests
* Update gradle-wrapper.properties
[V2] Fix iOS pop gesture when topBar is hidden (#4568)
* Fix iOS pop gesture when nav bar is hidden
* Add missing property
* Factor out InteractivePopGestureDelegate into its own file
* Add missing import
* Make sure fix supports hidden and visible nav bars
* Minor code style fix
Until now controlling drawers touch gestures was impossible, drawers received gesture opening touch from the entire screen and that causes collisions with other gestures (which are implemented on the javascript side).
This commit adding modes for how sideMenu drawers gestures will receive opening touch.
```
{
sideMenu: {
openGestureMode: 'entireScreen' | 'bezel'
}
}
```
- `entireScreen`: drawer gesture will trigger drawer opening from the entire screen
- `bezel`: drawer gesture will trigger drawer opening only from the center screen bezel frame
The default didn't change.
* bind viewController to presenters using bindViewController
* Merge options to the specific provided layout
* Moved custom titleView creation to RNNRootViewController
* Moved default options to presenters, moved options applying to presenters, resolved options in RNNOptionsResolver
* Fixes merge options
* Fixes topBar transition on pop
* Prevent titleView creation when react titleView exists
* Fixed unit tests
* Options refactor WIP
* Detach applied options from DTO - WIP
* Added option types and option parsers
* Unit test passes
* Added presenters for each parent type
* Fixes unit tests
* Rename StringParam to Text, changed bottomTabs.drawBehind and topBar.drawBehind default to false
* set layout.backgroundColor default to white
* Added unit tests for RNNViewControllerPresenter
* Set layout.backgroundColor default nil
* Fixes buttons color missing options
* Fix unit test
* fix button color parsing
* Moved default options to presenters
* default options fixes
* Fixes e2e
* Fixes unit tests
* Resolve child options on childWillAppear
* Recrusively setDefaultOptions on rootViewController tree
* Fixes default values
* Fixes tests
* Renamed RNNRootViewProtocol to RNNParentProtocol and added RNNLeafProtocol
* fixed unit test
* Better options resolving
* Revert "Revert "Refactor options (#3962)""
This reverts commit c266041b85.
* Revert "Revert "Fixes shared element transition""
This reverts commit 005f039f7c.
* Revert "Revert "Adresses #3963 - stack options applied to children""
This reverts commit be09cb0e9a.
* Revert "Revert "Added unit test coverage for RNNNavigationController""
This reverts commit 199cebd221.
* Merge stack options
This commits adds support for merging stack options by the stack’s componentId
Also while I’m at it - use fade animation when setting root
* Merge BottomTabs options
Merge BottomTabs options when calling mergeOptions with BottomTabs componentId
* Fixes options