反应本机基本标题中心对齐

dev*_*edv 2 react-native native-base

我正在使用本机反应。我想在iOS和android两者中居中对齐标题,因为文本很长,所以用“…”将其隐藏。flex:3完全应用显示标题,但不会使标题居中对齐。即使申请alignItems: 'center',alignSelf: 'center'也无济于事。

我试过其他选项无法修复它。我该如何解决?

码:

 <Header  iosStatusbar="light-content" androidStatusBarColor='#000' >
<Left style={{flex:1}}>
<Button transparent onPress={() =>  this.navigateCustom("goBack")}>
 <Icon name="arrow-back" />
 </Button>
</Left>

    <Body style={{flex:3,}}>
     <Title>THIS IS A LONG TITLE TEST</Title>
   </Body>

  <Right style={{flex:1}}>
  <Button transparent onPress={()=> this.navigateCustom("DrawerOpen") }>
     <IconEvil  name={"menu"}  style={{ color: "rgb(255,255,255)", fontSize:30}}/>
     </Button>
  </Right>
      </Header>
Run Code Online (Sandbox Code Playgroud)

编辑:将flex:1和身体的中心对齐后 在此处输入图片说明

Lot*_*s91 7

您可以同时使用justifyContentalignItems使其居中,如下所示flex:1

 <Body style={{ flex: 1,  justifyContent: 'center', alignItems: 'center' }}>
   <Title>THIS IS A LONG TITLE TEST</Title>
 </Body>
Run Code Online (Sandbox Code Playgroud)