User interface 为什么边框的颜色不';你不会变吗?
我有文本输入,它应该是一个边框,当我试图定义边框颜色时,它不会改变,只是保持灰色,为什么 下面是我用来呈现带边框的TextInput的代码:User interface 为什么边框的颜色不';你不会变吗?,user-interface,react-native,User Interface,React Native,我有文本输入,它应该是一个边框,当我试图定义边框颜色时,它不会改变,只是保持灰色,为什么 下面是我用来呈现带边框的TextInput的代码: import React, {Component} from 'react'; import { StyleSheet, View, Text, Image, TextInput, AppRegistry } from 'react-native'; class Profile extends Component { rende
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);
import React,{Component}来自'React';
进口{
样式表、视图、文本、图像、文本输入、AppRegistry
}从“反应本机”;
类概要文件扩展了组件{
render(){
返回(
this.password=ref}
onFocus={()=>this.password.focus()}
onChangeText={(text)=>this.setState({password:text})}
underlineColorAndroid=“透明”
占位符textcolor=“#ffffffff”
占位符='Password'/>
);
}
}
const styles=StyleSheet.create({
简介:{
总数:46,
弹性:1,
为内容辩护:“中心”,
对齐项目:“居中”,
背景颜色:“#f0aa14”
},
登录方式:{
身高:36,
flexDirection:'行',
justifyContent:“flex start”,
对齐项目:“居中”,
边界宽度:1,
边框颜色:“白色”,
边界半径:20,
立面图:1,
marginBottom:25
},
文本输入值:{
弹性:1,
自我定位:“中心”
}
});
AppRegistry.registerComponent('test',()=>Profile);
我希望边框的颜色应该是白色,但它是灰色的,如何修复它
这就是我想要的:
您能试试下面的款式吗
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,
,在textInputValue类中添加了marginHorizontal:20,
请检查是否可以添加更多代码?要追踪UI问题,重建它并准确了解发生了什么是非常重要的on@vanBrunneren只是添加了更多的代码一个小问题,也许你知道,我应该改变什么样的样式,这样文本就会精确地显示在这个矩形的中心?只需在文本输入中添加
textAlign={“center”}