underlineColorAndroid 在 android 中不起作用 [英] underlineColorAndroid not working in android
本文介绍了underlineColorAndroid 在 android 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
react-native-cli: 2.0.1
react-native: 0.52.2
在我的 ios 设备表单中看起来不错,但在 android 设备中它在 TextInput 上显示底部边框,
In my ios device form looks good but in android device its showing bottom border on TextInput,
class Input extends Component {
render(){
return(
<View style={styles.container}>
<Text style={styles.lableStyle}>{this.props.label}</Text>
<TextInput
secureTextEntry={this.props.secureTextEntry}
placeholder={this.props.placeHolder}
autoCorrect={false}
value={this.props.value}
onChangeText={this.props.onChangeText}
underlineColorAndroid={this.props.borderColor} // not working
style={styles.textInputStyle} />
</View>
);
}
}
从 LoginForm 传递道具:
passing props from LoginForm:
render(){
return(
<Card>
<CardSection>
<Input
borderColor="transparent" //props for border
label="Email"
placeHolder="abc@example.com"
onChangeText={this.onEmailChanged.bind(this)}
value={this.props.email}
/>
</CardSection>
<CardSection>
<Input
borderColor="transparent" // props for border
secureTextEntry
label="Password"
placeHolder="password"
onChangeText={this.onPasswordChanged.bind(this)}
value={this.props.password}
/>
</CardSection>
{this.errorRender()}
<CardSection>
{this.spinerRender()}
</CardSection>
</Card>
);
}
mac 截图
安卓截图
推荐答案
终于解决了.underlineColorAndroid 属性对我不起作用.所以我在android res中添加样式.
Finally solved it. underlineColorAndroid attribute not work for me. so i add style in android res.
打开这个路径:android/app/src/main/res/values/styles.xml
open this path: android/app/src/main/res/values/styles.xml
并以样式添加此行:
<item name="colorAccent">#FFFFFF</item>
<item name="colorControlNormal">#FFFFFF</item>
它适用于安卓
这篇关于underlineColorAndroid 在 android 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文