Can't center title in react navigation stack – React-Native?

I can’t center the title in react-navigation V4+ its work fine before with v3, when use RN-stack I can’t center the title for some reason I don’t know.

it just appears on the right,

I try these in headerTitleStyle and headerStyle

justifyContent, alignItems and alignSelf but not works :/

If you have any idea about it tell me?

"react-navigation": "^4.0.10",
"react-navigation-drawer": "^2.3.3",
"react-navigation-stack": "^2.0.16",
"react-native-screens": "^2.0.0-alpha.29",

here’s Code

static navigationOptions = ({navigation}) => {
    const showModal = navigation.getParam('showModal', () => {});
    return {
      title: navigation.getParam('title'),
      headerTitleStyle: {
        fontFamily: 'Cairo-Regular',
        fontSize: Platform.OS == 'ios' ? 16 : 18,
        color: '#fff',
        flex: 1,
        textAlign: 'center',
      },
      headerStyle: {
        backgroundColor: navigation.getParam('color'),
      },
      headerRight: (
        <Grid>
          <Row>
            <Body>
              <Button
                transparent
                icon
                onPress={() => {
                  navigation.openDrawer();
                }}>
                <Icon
                  name="ios-menu"
                  type="Ionicons"
                  style={{fontSize: 25, color: '#fff'}}
                />
              </Button>
            </Body>
            {!navigation.getParam('title').includes('details') && (
              <Body>
                <Button transparent icon onPress={() => showModal()}>
                  <Icon
                    name="more"
                    type="Ionicons"
                    style={{fontSize: 25, color: '#fff'}}
                  />
                </Button>
              </Body>
            )}
          </Row>
        </Grid>
      ),
      headerLeft: (
        <Grid>
          <Row>
            <Body>
              <Button
                transparent
                icon
                onPress={() => {
                  navigation.pop();
                }}>
                <Icon
                  name="arrow-round-back"
                  type="Ionicons"
                  style={{
                    fontSize: Platform.OS == 'ios' ? 30 : 25,
                    color: '#fff',
                  }}
                />
              </Button>
            </Body>
            <Body>
              <Button
                transparent
                icon
                onPress={() => {
                  navigation.navigate('search');
                }}>
                <Icon
                  name="search"
                  type="Ionicons"
                  style={{
                    fontSize: Platform.OS == 'ios' ? 30 : 25,
                    color: '#fff',
                  }}
                />
              </Button>
            </Body>
          </Row>
        </Grid>
      ),
    };
  };

154 thoughts on “Can't center title in react navigation stack – React-Native?”

  1. Pingback: custom keto diet
  2. Somebody essentially lend a hand to make critically posts I’d
    state. That is the first time I frequented your web page and to this point?
    I surprised with the analysis you made to make this actual post amazing.
    Fantastic task!

    Reply
  3. I appreciate, cause I discovered exactly what I used to be taking a
    look for. You have ended my four day long hunt! God Bless you man. Have a great day.
    Bye

    Reply
  4. Having read this I thought it was rather informative.
    I appreciate you taking the time and energy to put this content together.
    I once again find myself personally spending way
    too much time both reading and leaving comments. But so what, it
    was still worthwhile!

    Reply
  5. Hi would you mind letting me know which web host you’re using?
    I’ve loaded your blog in 3 different internet browsers and I must say this blog loads a lot faster then most.
    Can you recommend a good web hosting provider at a reasonable price?
    Kudos, I appreciate it! quest bars http://j.mp/3C2tkMR quest bars

    Reply
  6. I don’t know if it’s just me or if everybody else experiencing issues with your website.

    It appears as though some of the written text on your content
    are running off the screen. Can someone else please comment and let me know if
    this is happening to them as well? This might be a issue with my
    internet browser because I’ve had this happen previously.

    Kudos scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

    Reply
  7. Unquestionably consider that which you said. Your favorite
    justification seemed to be on the internet the easiest thing to be aware
    of. I say to you, I definitely get annoyed at the same time
    as other people think about issues that they just do not realize about.
    You controlled to hit the nail upon the highest and also outlined out the
    entire thing without having side effect , folks could
    take a signal. Will probably be back to get more.
    Thank you part time jobs hired in 30 minutes https://parttimejobshiredin30minutes.wildapricot.org/

    Reply
  8. Pingback: nolvadex price
  9. Pingback: latisse
  10. While there were inconsistencies in the rate of preterm births 100 , all the above studies confirm that metformin is safe, with no significant maternal or neonatal adverse effects, and that metformin has improved neonatal outcomes compared with insulin. clomid pct dosage

    Reply
  11. Metabolite Biomarkers of Response BoRs Towards a fingerprint for the evolution of metastatic breast cancer clomid in males Experimental Design To discover kinases that drive prostate cancer progression, we investigated the association between gene expression of all known kinases and long term clinical outcomes in tumor samples from 545 patients with high risk disease

    Reply

Leave a Comment