android - underlineColorAndroid 不能在 android 中工作

标签 android react-native textinput

react-native-cli: 2.0.1
react-native: 0.52.2

在我的 ios 设备表单中看起来不错,但在 android 设备中它在 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 传递 Prop :

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 截图

enter image description here

安卓系统截图

enter image description here

最佳答案

TextInput has by default a border at the bottom of its view. This border has its padding set by the background image provided by the system, and it cannot be changed. Solutions to avoid this is to either not set height explicitly, case in which the system will take care of displaying the border in the correct position, or to not display the border by setting underlineColorAndroid to transparent.

underlineColorAndroid="透明" 和 填充:0

关于android - underlineColorAndroid 不能在 android 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48638667/

相关文章:

android - 由 : java. 引起 lang.ClassNotFoundException: 没有找到类 "android.webkit.SafeBrowsingResponse"

Android Camera2 API 手动曝光更改

java - 计算文件中的字符数

javascript - react 原生构建错误 : Attempt to invoke virtual method'boolean com. facebook.react.uimanager.FabricViewStateManager.hasStateWrappper()

html - 对齐文本输入下方的标签

android - 在绑定(bind)之前启动服务

android - Google Play 游戏服务 : show unlocked achievement

react-native - 如何将 FCM(firebase 云消息传递)与 react-native 集成

ios - 使用 React Native 项目设置 cocoa pod

android - React Native:任务:app:installDebug失败