Skip to content

Latest commit

 

History

History
64 lines (52 loc) · 1.55 KB

Input.md

File metadata and controls

64 lines (52 loc) · 1.55 KB

<Input /> 输入框

Input 组件定义一个输入编辑框。

Props

Prop Type Default Note
TextInput props... Input 组件继承 TextInput 组件的全部属性。
size string 'md' 显示尺寸大小。
- lg: 大
- md: 中
- sm: 小
显示效果参见Screenshots
disabled bool false 组件是否禁用, 为 true 时组件显示为半透明且不可聚焦。
underlineColorAndroid string 'rgba(0, 0, 0, 0)' 继承自 TextInput 并修改默认值。

Events

Event Name Returns Notes
TextInput events... Input 组件继承 TextInput 组件的全部事件。

Example

简单用法

<Input style={{width: 200}} />

使用 size、value 属性

<Input style={{width: 200}}
  size='lg'
  value={this.state.value}
  onChangeText={text => this.setState({value: text})}
  />

只读

<Input style={{width: 200}} editable={false} />

禁用

<Input style={{width: 200}} disabled={true} />

自定义

<Input
  style={{width: 200, backgroundColor: '#fcf8e3', borderColor: '#8a6d3b', color: '#8a6d3b', textAlign: 'right'}}
  value={this.state.valueCustom}
  onChangeText={text => this.setState({valueCustom: text})}
  />

Screenshots