TextInput常用属性
- value
文本输入的默认值,赋值后UI不能修改 - keyboardType
键盘类型,enum(‘default’, “ascii-capable”, ‘numbers-and-punctuation’, ‘url’, ‘number-pad’, ‘phone-pad’, ‘name-phone-pad’, ‘email-address’, ‘decimal-pad’, ‘twitter’, ‘web-search’, “numeric”) - multiline
如果值为真,文本输入可以输入多行。默认值为假 - password
如果值为真,文本输入框就成为一个密码区域。默认值为假
注:如果设置了多行,那么这个属性不适用 - placeholder
在文本输入之前字符串将被呈现出来,通常被称为占位文字 - placeholderTextColor
占位文字的颜色 - clearButtonMode
清除按钮出现在文本视图右侧的时机(‘never’, ‘while-editing’, ‘unless-editing’, ‘always’)
<View style={styles.container}>
<TextInput
style = {styles.inputStyle}
value = 'UI改不来'
keyboardType = 'number-pad'
multiline = {true}
password = {true}
placeholder = '占位文字'
clearButtonMode = 'always'
>
</TextInput>
</View>