Socket
Socket
Sign inDemoInstall

nuke-text-input

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-text-input

输入框


Version published
Weekly downloads
2
decreased by-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

TextInput

  • category: Components
  • chinese: 输入框
  • type: 基本

何时使用

TextInput 是唤起用户输入的基础组件。 当定义 multiline 输入多行文字时其功能相当于 textarea。

API

属性说明类型默认值
multiline【与multiple 重复,即将废弃】定义该属性文本框可以输入多行文字booleanfalse
multiple定义该属性文本框可以输入多行文字booleanfalse
accessibilityLabel为元素添加标识string
autoComplete添加开启自动完成功能booleanfalse//todo
autoFocus添加开启获取焦点booleanfalse
editable文本框是否可编辑booleantrue
keyboardType【 与type 重复,即将废弃】设置弹出哪种软键盘 可用的值有default ascii-capable numbers-and-punctuation url number-pad phone-pad name-phone-pad email-address decimal-pad twitter web-search numericstringdefault
type设置弹出哪种软键盘 可用的值有text number url password tel date time emailstringtext
maxLength设置最大可输入值number
maxNumberOfLines当文本框为mutiline时设置最多的行数number
numberOfLines同上设置行数number
placeholder设置文本框提示string
password【与type 重复,即将废弃】文本框内容密码显示
secureTextEntry【与type 重复,即将废弃】同上文本框内容密码显示
value文本框的文字内容string
style自定义样式Object

同时 TextInput 响应下面几个事件:

  • onBlur: 文本框失焦时调用此函数。onBlur={() => console.log('失焦啦')}
  • onFocus: 文本框获得焦点时调用此函数
  • onChange: 文本框内容变化时调用此函数
  • onInput: 文本框输入内容时调用此函数

使用示例:

<TextInput
        placeholder="Enter text to see events"
        autoFocus multiline
        onFocus={() => console.log('onFocus')}
        onBlur={() => console.log('onBlur')}
        onInput={() => console.log('onInput')}
        style={{
                width: '1000rem',
                height: '1000rem',
                borderWidth:'1rem',
                borderStyle:'solid',
                borderColor:'#cccccc'
        }}
/>

Keywords

FAQs

Package last updated on 03 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc