小编Ahs*_*war的帖子

React-Native按钮对齐中心

我正在使用原生基本按钮我想对齐屏幕中心的按钮我试过这个:

<Container style={{flex:1,
    flexDirection:'row',
    alignItems:'center',
    justifyContent:'center',}}>
         <Form style={{}}>
              <Item last>
                    <Input placeholder='Username' 
                    style={{color:'white'}}/>
                </Item>
              <Item last>
                  <Input placeholder="Password"
                  style={{color:'white'}} />
              </Item>

              <Button style={{width:170,backgroundColor:'#99004d',marginTop:20,}}>
                    <Text style={{marginLeft:50}}>Login</Text>
              </Button>

              <Text style={{color:'white'}}>{this.props.Name}</Text>
          </Form>
        </Container>
Run Code Online (Sandbox Code Playgroud)

但它减少了输入字段的大小我得到的结果如下:

在此输入图像描述

reactjs react-native native-base

9
推荐指数
1
解决办法
3万
查看次数

标签 统计

native-base ×1

react-native ×1

reactjs ×1