简体   繁体   English

TextInput为react-native中的ios加下划线颜色

[英]TextInput underline color for ios in react-native

i am doing mobile applications in react-native for android and ios. 我正在为Android和ios做反应原生的移动应用程序。 In my project i am using TextInput Component(ios). 在我的项目中,我正在使用TextInput Component(ios)。 This component appear without underline. 此组件显示没有下划线。 How to use TextInput with underline color in ios. 如何在ios中使用带下划线颜色的TextInput。

code sample - 代码示例 -

<TextInput
 ref={'cardbatch1'}                 
 keyboardType = 'numeric'
 placeholder = 'Batch Number'
 autoCapitalize = 'none'                                                    
/>

您可以将borderBottomWidth和borderBottomColor添加到TextInput,或者只是在TextInput下绘制1或2像素高度的视图。

Try this in styles.. see the difference in output 在样式中尝试这个..看看输出的差异

const styles = StyleSheet.create({

    inputBox: {
        .....
        borderBottomWidth: 1,
        borderBottomColor: 'gray',
        ....
    }
});

Finally add the style in textInput 最后在textInput中添加样式

<TextInput
 ...             
 keyboardType = 'numeric'
 placeholder = 'Batch Number'
 autoCapitalize = 'none'
 style={styles.inputBox}
.....                                                    
/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM