React-native: [Android] navigationBar title is not in the middle

Created on 30 Sep 2015  路  8Comments  路  Source: facebook/react-native

Locked

Most helpful comment

@mehdipourfar if you do as

<Navigator.NavigationBar
  navigationStyles={Navigator.NavigationBar.StylesIOS}
/>

it works for me.

All 8 comments

You have to adjust the margin to center it vertically. Also, about removing the left margin, if you do that, it'll overlap any buttons on the left.

I'm wondering why flexbox is not used to align the buttons and titles instead of absolute positioning.

@satya164 I just make it like ios. And I use marginTop to make the title center vertically

https://github.com/facebook/react-native/blob/master/Libraries/Components/Navigator/NavigatorNavigationBarStyles.android.js

This is intentional, based on platform specific ui differences. #3028 makes it possible to use iOS navbar styles on Android and vice versa.

Thank you .It's worked for me.

@brentvatne What are the platform specific UI differences that you are referring to regarding this issue? I am not very familiar with Android UI but from what I understand, there is a navigation stack that is maintained when an intent starts a new activity but there is no standard navigation bar with a title and back button as there is in iOS. So why is it that the title is not centred by default like in iOS?

The problem still exists. After wasting 2 hours of my time trying to debug my styles, I had to resort to this quick fix for solving it.

http://stackoverflow.com/questions/35867954/changing-the-default-style-for-a-navigator-navigationbar-title

@mehdipourfar if you do as

<Navigator.NavigationBar
  navigationStyles={Navigator.NavigationBar.StylesIOS}
/>

it works for me.

Was this page helpful?
0 / 5 - 0 ratings