9

I have just discovered NativeBase for react-native and I really love it. I am following the tutorial from their website. I understand that NativeBase uses Easy-Grid for the layout. I would like to vertically center a button on my page. This is a simple interface for a test application I am building:

<Container> 
    <Header>
        <Button trnsparent>
            <Icon name='ios-menu' />
        </Button>             
        <Title>Poki</Title>                    
    </Header>

    <Content style={{padding: 10}}>  
        <Grid>
            <Col>
                <Button block bordered info style={{flex: 1}}>Login</Button>
            </Col>
        </Grid>
    </Content>

    <Footer>
        <FooterTab>
            <Button transparent>
                <Icon name='ios-call' />
            </Button>  
        </FooterTab>
    </Footer>
</Container>

And this is the result on my genymotion emulator: enter image description here

How can I vertically center the login button on my page using easy-grid? I have tried to apply flexbox properties with no result.

Thank you for your help.

4

2 回答 2

20

尝试更改为:

<Content contentContainerStyle={{flex: 1}} style={{padding: 10}}>
  <Grid style={{alignItems: 'center'}}>
    <Col>
      <Button block bordered info>
        Login
      </Button>
    </Col>
  </Grid>
</Content>
于 2016-12-17T12:58:29.980 回答
0

我也尝试了这段代码:

<Grid >
    <Col>
        <Row>
            <Text>Ananta Riding Club</Text>
        </Row>
    </Col>
    <Col contentContainerStyle={{flex: 1}}>
        <Row style={{justifyContent: 'flex-end'}}>
            <Text >07.00 AM</Text>  
        </Row>
    </Col>
</Grid>
于 2019-03-03T13:51:58.020 回答