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

Fixed the Header Title Center bug on Android #4248

Closed
wants to merge 1 commit into from

Conversation

rbhatia46
Copy link

The Title in the header of the Stack Navigator wasn't centred by default for Android Devices and was set to 'flex-start' for any devices without iOS.

The main motivation was when I was trying to build an Instagram UI Clone in React Native on Android. I used the title in navigation options and saw that the title wasn't centred by default for Android devices whereas it was for the iOS devices. I had a look at the Header source code and figured out that for devices other than iOS, the value should be 'centre' instead of 'flex-start' which indeed solved the issue.

Please refer to the screenshots below and after the changes:

Before

Before

After

After

Everything works fine on iOS by default but I guess this fixes the problem on Android devices.

@react-navigation-ci
Copy link

@brentvatne
Copy link
Member

hi there! this behavior is intentional. by default on android the text is aligned to the left. open issue on rfcs for this: react-navigation/rfcs#38

if you'd like to open a rfc on that repo please do

@brentvatne brentvatne closed this May 23, 2018
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

3 participants