您当前的位置: 首页 >  react native

xiangzhihong8

暂无认证

  • 0浏览

    0关注

    1324博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

React Native控件只TextInput

xiangzhihong8 发布时间:2016-09-17 19:06:27 ,浏览量:0

TextInput是一个允许用户在应用中通过键盘输入文本的基本组件。本组件的属性提供了多种特性的配置,譬如自动完成、自动大小写、占位文字,以及多种不同的键盘类型(如纯数字键盘)等等。

比如官网最简单的写法:

import React, { Component } from 'react';
import { AppRegistry, TextInput } from 'react-native';

class UselessTextInput extends Component {
  constructor(props) {
    super(props);
    this.state = { text: 'Useless Placeholder' };
  }

  render() {
    return (
      {height: 40, borderColor: 'gray', borderWidth: 1}}
        onChangeText={(text) = this.setState({text})}
        value={this.state.text}
      />
    );
  }
}

// App registration and rendering
AppRegistry.registerComponent('AwesomeProject', () => UselessTextInput);
关注
打赏
1482932726
查看更多评论
立即登录/注册

微信扫码登录

0.0624s