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

Example: Centered title in navigation bar #2172

Merged
merged 1 commit into from
Aug 3, 2017
Merged

Example: Centered title in navigation bar #2172

merged 1 commit into from
Aug 3, 2017

Conversation

mikaello
Copy link
Contributor

@mikaello mikaello commented Aug 2, 2017

I Android the title in the navigation bar is not centered by default, only in iOS. By setting titleStyle={{alignSelf='center'}} for a Scene-component the title is centered in Android as well. See also issue 253 in react-navigation.

@PiotrKujawa
Copy link

Hi,
alignSelf will only work if there's no left or right titles/buttons. Otherwise the title is not centered.
Any solution for this? Or maybe I'm doing something wrong?

android_title_alignment

@kamranyounis12
Copy link

a simple workaround can be providing rightTitle=" " in the props of scene.
<Scene key='yourKey' component={YourComponent} titleStyle={{alignSelf='center'}} title="your_title" rightTitle=" "/>

@mikaello mikaello deleted the centering-of-title-in-nav-bar branch February 20, 2018 06:21
@Mimicx
Copy link

Mimicx commented Apr 16, 2018

What happen if only want the rightButton, there is not a leftTitle, any solution?

@mdelclaro
Copy link

@PiotrKujawa were you able to resolve this issue?

@monkxp
Copy link

monkxp commented Jul 3, 2019

headerTitleStyle: { flex: 1, textAlign: 'center' }, headerLeft: (<View/> ), headerRight:(<View/>)
It's work for me.

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

Successfully merging this pull request may close these issues.

None yet

7 participants