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
* Revert "Handle NPE when showing Overlay before setRoot is called"
This reverts commit e4db9e6419.
* Revert "Fix test: Check if the button the sidemenu is no longer visible (#3779)"
This reverts commit 26c12f7757.
* Revert "Closes #3545"
This reverts commit 054ae64cdf.
* Revert "Address possible NPE in detachView and attachView"
This reverts commit f2f5eaf2d4.
* Revert "Fix crash when user tapped on screen before initial meaningful render"
This reverts commit 48b7d60bf7.
* Revert "Check if tab exists before applying tab options"
This reverts commit 3073f295fb.
* Revert "Null check tabTestId"
This reverts commit 770a001ba9.
* Revert "Don't crash if Modal related commands are called before root is set"
This reverts commit aa8135dcbf.
* Revert "Closes #3545 (#3874)"
This reverts commit feab91de5c.
* Revert "Update Installing.md (#3870)"
This reverts commit 5cecd814f6.
* Revert "Update docs"
This reverts commit 98053e60ec.
* Revert "Delegate onNewIntent to reactInstanceManager"
This reverts commit 3074407577.
* Revert "Removed the headers form copy build phase - they are copied as headers. This was causing build error on Xcode 10 (#3774)"
This reverts commit ed657c99a1.
* Refactored bottomTab and bottomTabs
* Initial commit before switching to our fork of AHBottomNavigation
* Bump AHBottomNavigation version
* More work on BottomTab options
Need to merge some child options when a child is attached to parent
* Fix tests
* DefaultOptions refactor
* defaultOptions are now merged before applying options
* Handle BottomTab options in dedicated presenter
* Create BottomTabs in BottomTabsController.createView() instead of constructor
* Set bottomTab TypeFace
* Update Android installation guide
* fixed unit tests
* Fix unit tests
Kind of a workaround
* Handle NPE in getPreferredHeight
If a view hasn't been attached yet, return 0 height
* Apply BottomTab text and icon color individually
wix-playground/AHBottomNavigation does not support setting color for the entire tab (icon and text),
instead it supports setting color individually to text and icon. Another change is that it no longer supports
default color for icons. If icon color is undefined - it won't tint the icon.
* Add getCurrentChild to ParentController contract
* Clear backButton when setting stack root
* Add ViewController.resolveCurrentOptions
resolveCurrentOptions merges the controllers options with all of its current children
* StackController refactor
* Create pushed child view only in StackController.createView
* When initialising a stack with multiple children, only create the top child's view
* StackController constructor now accepts children
* When pushing child to stack, apply options that change LayoutParams
* Apply BottomTabs layout options when tab views are created
* bototmTab changes in iOS
* options fix
* Fixes options propagating