我有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);
我希望边框的颜色应该是白色的,但它是灰色的,如何解决?
这就是我想要的:
答案 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,
。
请检查