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传递道具:

render(){
        return(
            <Card>
                <CardSection>
                    <Input
                        borderColor="transparent" //props for border
                        label="Email"
                        placeHolder="[email protected]"
                        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的ScreenShot

android - underlineColorAndroid无法在android中工作-LMLPHP

Android的ScreenShot

android - underlineColorAndroid无法在android中工作-LMLPHP

最佳答案

在您的loginForm中将其更改为此

           <Input
                    borderColor='transparent'// props for border
                    secureTextEntry
                    label="Password"
                    placeHolder="password"
                    onChangeText={this.onPasswordChanged.bind(this)}
                    value={this.props.password}
                />

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

10-13 03:41