为什么边境的颜色不会改变?

时间:2017-03-28 14:16:57

标签: user-interface react-native

我有TextInput,它应该是它周围的边框,当我试图定义边框颜色时,它不会改变,只是保持灰色,为什么会这样?

以下是我用于使用border:

呈现TextInput的代码
    import React, {Component} from 'react';
 import {
     StyleSheet, View, Text, Image, TextInput,  AppRegistry
 } from 'react-native';

class Profile extends Component {

render() {
        return (
            <View style={styles.profile}>
                   <View style={[styles.loginRow, {marginBottom: 8}]}>

                        <TextInput
                            style={styles.textInputValue}
                            ref={(ref) => this.password = ref}
                            onFocus={() => this.password.focus()}
                            onChangeText={(text) => this.setState({password: text})}
                            underlineColorAndroid="transparent"
                            placeholderTextColor="#ffffff"
                            placeholder='Password'/>

                    </View>
            </View>
 );
    }

}

const styles = StyleSheet.create({

profile: {
        padding: 46,
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#f0aa14'
    },

        loginRow: {
                height: 36,
                flexDirection: 'row',
                justifyContent: 'flex-start',
                alignItems: 'center',
                borderBottomWidth: 1,
                borderColor: 'white',
                borderRadius:20,
                elevation: 1,
                marginBottom: 25

            },

        textInputValue: {
                flex: 1,
                alignSelf: 'center'

            }
    });


AppRegistry.registerComponent('test', () => Profile);

我希望边框的颜色应该是白色的,但它是灰色的,如何解决?

enter image description here

这就是我想要的:

enter image description here

1 个答案:

答案 0 :(得分:1)

请试试以下风格

loginRow: {
    height: 36,
    flexDirection: 'row',
    justifyContent: 'flex-start',
    alignItems: 'center',
    borderColor: 'white',
    borderWidth: 1,
    borderRadius: 20,
    elevation: 1,
    marginBottom: 25

},

textInputValue: {
    flex: 1,
    marginHorizontal: 20,
    alignSelf: 'center'

}

我所做的是,对于loginRow类而不是borderBottomWidth: 1,,我更改了borderWidth: 1,并在textInputValue类上添加了marginHorizontal: 20,

请检查