React-navigation do navigation bar, find the title on Android is not centered

Source: Internet
Author: User

When doing React Native application, we often use react-navigation to do navigation bar, found that the title on Android is not centered, no problem on IOS.

1 if only the title, then the Headertitlestyle set alignself: ' Center ' will be.
2 If there is a return button on the left side of the title bar and the title is still not centered on the right, the simple way to do this is:
Add an empty View of equal width and height to the right, as follows:

headerRight: <View />

After upgrading the new version found that this trick, you can set flex:1 in Headertitlestyle, textAlign: ' Center ' to achieve.



wwpeng520
Links: https://www.jianshu.com/p/0f55925206f7
Source: Pinterest
The copyright of the book is owned by the author, and any form of reprint should be contacted by the author for authorization and attribution.

React-navigation do navigation bar, find the title on Android is not centered

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.