Input
组件引入
import InputCom from "..."
组件功能
- 顶部搜索框
- form表单输入框
- 文本域
- 顶部搜索框-搜索图标的展示
- 输入框清楚图标
- form输入框错误提示
Demo
顶部搜索框
<InputCom style={{backgroundColor:'#fff',margin:10,width:250}} isRadius // maxLength={10} placeholderTextColor={'green'} // textColor={'red'} textStyle={{color:'green'}} // rightIcon isShowCloseBtn isShowIcon // defaultValue={'88888'} onChangeText={(val)=>{ this.setState({ inputVal:val }) }} />
form表单与错误提示
<InputCom type={"form"} style={{backgroundColor:'#eee'}} formStyle={{backgroundColor:'#fff',margin:10,}} placeholderTextColor={'green'} textStyle={{color:'green'}} isShowCloseBtn formTitleWidth={100} errorText={'错误提示'} title={'年龄'} // defaultValue={'88888'} onChangeText={(val)=>{ this.setState({ inputVal:val }) }} />
props
Attribute | Description | Type | Accepted values | default |
---|---|---|---|---|
type | input类型 | String | form/textarea/search | search |
style | 搜索框样式 | Obj | ||
editable | 是否可以编辑 | Boolean | true | |
placeholder | 搜索框占位文字 | String | 请输入... | |
placeholderTextColor | 搜索框占位文字颜色 | String | ||
isShowIcon | 是否显示搜索图标 | Boolean | false | |
iconSource | 搜索图片地址 | 有默认 | ||
isShowCloseBtn | 是否显示删除图片 | Boolean | false | |
closeImgSource | 删除图片地址 | 有默认 | ||
inputRef | 搜索框节点对象 | |||
maxLength | 搜索框最大输入限制 | Number | 20 | |
defaultValue | 搜索框默认值. | String | ||
value | 搜索框值 | |||
keyboardType | 键盘类型 | String | default/number-pad/decimal-pad/numeric/email-address/phone-pad | default |
width | 搜索框宽度 | Number | 200 | |
formTitleWidth | 表单左边标题宽度,只在type为form下有效 | Number | 100 | |
textColor | 搜索框文本颜色 | String | ||
textStyle | 搜素框文本样式 | |||
rightIcon | 搜索图标位于搜索框末尾 | Boolean | false | |
autoCorrect | 是否自动修正 | Boolean | false | |
errorText | 错误提示文字 | String | ||
errorTextStyle | 错误提示样式 | |||
isRadius | 是否显示圆角 | Boolean | false | |
borderRadius | 圆角值 | Number | 20 | |
fontSize | 搜索框字体大小 | Number | 14 | |
title | 当type为form的时候,title为左边文字 | String | ||
formStyle | 当type为form的时候的样式 | |||
numberOfLines | 设置输入框的行数,当type为textarea是,设置为多行,numberOfLines与 keyboardType冲突 | Number | ||
titleStyle | 当form的时候,左边文本样式 |