无法对齐本机元素中的复选框

pra*_* vv 2 react-native

我是 react-native 的新手,我正在尝试使用 react-native 元素 1.00 beta4 中的所有输入组件创建一个简单的页面。我的问题是即使父视图 flexdirection 在 'row '。

注册.js

import React,{ Component } from 'react';
import { Field,reduxForm } from 'redux-form';
import { View,Button } from 'react-native';
import {Icon,CheckBox,Text,Input} from 'react-native-elements';
 const renderField=({label,keyboardType,name,icon,iconType}) => {
    return(
            <View style={{flexDirection:'row'}}>
                <Input placeholder={label} inputContainerStyle={{borderWidth:2,borderColor:'lightgrey',borderRadius:20}} inputStyle={{color:'grey'}} leftIcon={<Icon size={25} type={iconType} name={icon} color="grey" />} errorStyle={{fontSize:15}} errorMessage="error" />
            </View>
    )
}
 const checkBoxField=({label,keyboardType,name}) => {
    return(
            <View style={{flexDirection:'row'}}>
                <Text>{label}</Text>
                <CheckBox  title='Male' checkedIcon='dot-circle-o' uncheckedIcon='circle-o' checked={true} containerStyle={{backgroundColor:'transparent'}} />      
            </View>
    )
}

const RegisterForm=props => {
    const {handleSubmit}=props;
    return(
            <View style={{flex:1,flexDirection:'column',margin:20,justifyContent:'flex-start',alignItems:'center'}}>

                <Field label="Username" component={renderField} name="username" icon="user" iconType="font-awesome" />
                <Field label="Email" component={renderField} name="username" icon="email" iconType="zocial" />
                <Field label="Gender" component={checkBoxField} name="gender"  />
                <Button title='SUBMIT' onPress={handleSubmit} />

            </View>
    )
}
const Register=reduxForm({
    form:'register',
})(RegisterForm);
export default Register;
Run Code Online (Sandbox Code Playgroud)

输出

在此处输入图片说明

这里有什么问题?如何对齐复选框(使用 flexbox 算法)

RAN*_*RAI 5

你可以使用像justifyContentalginItem这样的 flex 属性,或者你也可以使用像alignTextalignSelf这样的Text属性。

 const checkBoxField=({label,keyboardType,name}) => {
    return(
            <View style={{flexDirection:'row',alignItems:'center',justifyContent:'center'}}>
                <Text style={{alignSelf:'center',textAlign:'center'}}>{label}</Text>
                <CheckBox  title='Male' checkedIcon='dot-circle-o' uncheckedIcon='circle-o' checked={true} containerStyle={{backgroundColor:'transparent'}} />      
            </View>
    )
}
Run Code Online (Sandbox Code Playgroud)