react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

v3 alpha [05/08 alpha.11 published]

Open guyca opened this issue 7 years ago • 96 comments

3.0.0-alpha.11

Changes

  • [x] Support RN 0.60
  • [x] Migrate to AndroidX
  • [x] Improve draw behind StatusBar (Preparation for #4258)
  • [x] Don't push BottomTabs when keyboard is displayed (Fixes #4005, #3424) - It won't be needed to toggle the BottomTabs when Keyboard is visible
  • [x] 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 [email protected]. 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

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. Update: Fixed in 3.0.0-alpha.1 ~~If you've specified a custom TopBar animation which animates y or translationY properties, you'll need to compensate for the TopBar's topMargin. This is a temporary solution and will be addressed in one of the next alpha releases.~~ For example:

const statusBarHeight = getStatusBarHeight();
const topBarHeight = getTopBarHeight();
...
pop: {
  topBar: {
    enabled: true,
    y: {
      duration: 300,
      from: statusBarHeight,
      to: -topBarHeight + statusBarHeight
    }
  }
}
  1. 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 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 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

- 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

bottomTab: {
  badge: 'new,
  animateBadge: true
}

The following option will show a dot indicator with animation

bottomTab: {
  dotIndicator: {
    visible: true,
    animate: true
  }
}

guyca avatar Jun 23 '19 11:06 guyca

HI @guyca can you look at TopTabs issues. Currently V2 TopTabs doesn't support following options compared to v1.

  • selectedTopTabIndicatorHeight

  • selectedTopTabIndicatorColor

  • topTabsScrollable

  • topTabsHeight

Related Issues #5213, #5202, #4485, #5072.

Can we resolve this in V3?

syedabuthahirm avatar Jun 23 '19 17:06 syedabuthahirm

@guyca would be nice have topTabs working in this v3. I'm using a cross solution provided by Native Base, but has a poor perfomance.

By the way, great work you doing here!

mayconmesquita avatar Jun 23 '19 23:06 mayconmesquita

Hi, @guyca! Can you please look at iOS issues with topBar, especially with largeTitle enabled. There is too many bug with it, with merge options and animations. I showed some of them in issue #5145.

Thanks!

Crisis2010 avatar Jun 24 '19 06:06 Crisis2010

@mayconmesquita I stopped using Native Base for that same reason... Now I'm relying on react-navigation for tabs, and mixing the two isn't a good practice I think... and the performance is just a piece of junk...

t1amat9409 avatar Jun 24 '19 06:06 t1amat9409

And how about add feature not to hide topBar like hideOnScroll option but just change opacity on scrolling down from 0 (transparent) to 100%?

Crisis2010 avatar Jun 24 '19 07:06 Crisis2010

TopTabs - I'm terribly sorry for our lack of support for this component. We're just not getting to it. If anyone would like to take ownership of it please contact me. Our support for SideMenu was also lacking and we're only now slowly fixing its issue.

@Crisis2010 I doubt that will be implemented, sounds like a specific use case which you can implement without performance impact on your own. Regarding large titles - I'm aware there are issues with it, I hope to address them this quarter.

guyca avatar Jun 24 '19 07:06 guyca

I would love to fix the issue with Keyboard flickering when pushing screen with an input that has auto-focus. https://github.com/wix/react-native-navigation/issues/2622 is there something that comes to mind what the issue can be? I will try to fix it tonight.

pontusab avatar Jun 24 '19 08:06 pontusab

@pontusab Strange, I see we use autoFocus: true in quite a few places in the Wix app and never had issues with it 🤔

guyca avatar Jun 24 '19 09:06 guyca

@guyca Interesting! We have the same issue with 3 different apps and then the folks in the GitHub issue. Do you use waitForRender? and/or something else? In your app, is the keyboard visible directly on navigate? I will do a small repo with an example

pontusab avatar Jun 24 '19 09:06 pontusab

@pontusab We don't use waitForRender.

guyca avatar Jun 24 '19 11:06 guyca

@guyca The TopTabs is android-only or iOS too? I can take the ownership to help the Android support.

mayconmesquita avatar Jun 24 '19 23:06 mayconmesquita

@mayconmesquita Thanks for taking ownership. i already did some research on TopTabs Styles in the following issue #5202, #5072 (Those are already implemented V1 I think you can easily copy paste them). Tab Layout Native Code It maybe useful to you.

syedabuthahirm avatar Jun 25 '19 01:06 syedabuthahirm

@syedabuthahirm thanks for the research! It will be useful to start!

mayconmesquita avatar Jun 25 '19 02:06 mayconmesquita

hopefully it fixes this issue #5167

AbanoubNassem avatar Jun 25 '19 05:06 AbanoubNassem

@mayconmesquita TopTabs are implemented on both platforms. Contact me on Discord and I'd be happy to assist as much as I can 👍

guyca avatar Jun 25 '19 08:06 guyca

@guyca Please add system default navigation transition when pushing screen on Android. Currently, It has the bottom to top transition.

kamleshh-bms avatar Jun 26 '19 07:06 kamleshh-bms

Feel a d*ck for hijacking this issue a bit, but any chance this will be looked at? It only happens when using a SideMenu. https://github.com/wix/react-native-navigation/issues/5192

Literally zero reaction. A "we don't know either", or a small push to a possible solution would already be a great help. This is basically holding us from using native navigation in production.

svenlombaert avatar Jun 26 '19 12:06 svenlombaert

@guyca considering there's a focus on full-screen apps in the new version, is there any chance you could consider the following request which you've looked at before:

https://github.com/wix/react-native-navigation/issues/4866

Our app is mostly fullscreen but requires setting mergeoptions on every screen (componentdidappear) to ensure when an overlay displays that it doesn't override the statusbar styling. I haven't figured out another way around it.

pribeh avatar Jul 01 '19 01:07 pribeh

@pribeh I don't think this will be part of the fullscreen effort, but we already discussed this internally and will try to find a solution this quarter.

guyca avatar Jul 01 '19 05:07 guyca

Anyone using RN 0.60 - I'd appreciate if you could upgrade to 3.0.0-alpha.2 and let me know if you find any issues (Or don't have any 😄 )

guyca avatar Jul 02 '19 16:07 guyca