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
* Migrate project to workspace
This commit moves all unit tests to the playground workspace
* Fix ios unit tests
* Build pods before testing
* Build typescript before running iOS tests
* Remove xcode 10 support
Always merge options with parent controller (#5606)
Until now, mergeOptions would merge with parent controller only if mergeOptions was called with
a componentId. This commit fixes the issue and makes options merge correctly even when called with a layoutId.
# 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
* 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
Played around with context api, tried to get the wrapped component to rerender after global context
was updated - this is what I came up with.
Note: this commit makes the playground app use a newer js core as the js core which shipped with RN on Android
is missing javascript Proxy.
Closes #4517
Implement Element transition on Android
This commit adds basic support for Element transition to Android.
Currently, only Shared Transition is supported and only when pushing screens.
There are a few caveats you need to be aware of if you intend to use
this feature in its current state:
1. Since elements need to be laid out before the transition can start, Set `waitForRender: true` when pushing the destination screen.
2. Fade animation has to be used when pushing screens with shared elements.
API
```js
options: {
animations: {
push: {
waitForRender: true,
content: {
alpha: {
from: 0,
to: 1,
duration: 250
}
}
}
},
customTransition: {
animations: [
]
}
}
```
* 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
* Support RN 0.55.4
This commit adds support for RN 0.55.4 by introducing version specific build flavors - reactNative51
* Update scripts after introducing build flavors
* Update Android installation instruction on specifying build flavor