Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Title in navigation bar is not centered in Android (7.0) #2166

Closed
mikaello opened this issue Aug 2, 2017 · 4 comments
Closed

Title in navigation bar is not centered in Android (7.0) #2166

mikaello opened this issue Aug 2, 2017 · 4 comments

Comments

@mikaello
Copy link
Contributor

mikaello commented Aug 2, 2017

Version

  • react-native-router-flux v4 (same version as in Example-app, but also tested with 4.0.0-beta.15 with same result)

  • react-native v0.44.0 (also tested v0.46)

  • Samsung S7

  • Android 7.0

Expected behaviour

Title in navigation bar to be centered in both iOS and Android

Actual behaviour

Title in navigaton bar is not centered in Android (but is centered in iOS).

Android (wrong):
router_flux_not_centered_title

iOS (correct):
router_flux_ios_centered_title

Steps to reproduce

You can use the Example app:

# Get the code
git clone git@github.com:aksonov/react-native-router-flux.git
cd react-native-router-flux/Example

# Install dependencies
yarn

# Run it
react-native run-android

I have tried to center the title by adding centering-styles to titleStyle- and headerStyle-props, but with no result. The best I can do is adding Android-specific left-padding/margin to titleStyle to make it centered, but that is difficult with different titles and different screen sizes.

@aksonov
Copy link
Owner

aksonov commented Aug 2, 2017

react-navigation/react-navigation#253

@mikaello
Copy link
Contributor Author

mikaello commented Aug 2, 2017

Ah, thanks!

<Scene
  ...
  titleStyle={{alignSelf: 'center'}} 
/>

... solved the issue.

@mikaello
Copy link
Contributor Author

mikaello commented Aug 2, 2017

I created a PR #2172 with the example updated with this prop, if that is wanted in the example.

@mikaello mikaello closed this as completed Aug 2, 2017
@krishan-kumar-mourya
Copy link

For me it worked with
<Scene ... titleStyle={{ textAlign: 'center', flex: 1 }} />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants