TextInput
TextInput
/*
* TextInput 是一个允许用户在应用中通过键盘输入文本的基本组件
* 本组件的属性提供了多种特性的配置,如自动完成,自动大小写,占位文字,键盘类型等
* 常用:
* placeholder 占位符
* value 输入框的值
* password 是否密文输入
* editable 是否可编辑
* retureKeyType 键盘return键类型
* onChange 当文本变化时调用(绑定事件)
* onEndEditing 当结束编辑时调用
* onSubmitEditding 当结束编辑,点击提交按钮时调用
*
*
* 练习:点击搜索, alert显示 输入框的值
*
* */ var LessionTextInput = React.createClass({ getInitialState:function () {
return{
inputText:""
}
},
//输入框的onChange事件,有一个参数
getContennt:function (text) {
this.setState({
inputText:text
});
}, //按钮事件
clickBtn:function () {
alert(this.state.inputText)
}, render:function () {
return(
<View sytle={styles.container}>
<View style={styles.flex}>
<TextInput
style={styles.input}
returnKeyType="search"
placeholder="请输入内容"
onChangeText={this.getContennt}
/>
</View>
<TouchableOpacity style={styles.btn}>
<Text style={styles.search} onPress={this.clickBtn}>搜索</Text>
</TouchableOpacity>
</View>
);
}
}); var styles = StyleSheet.create({
container:{
flexDirection:"row",
height:45,
marginTop:25
},
flex:{
flex:1
},
input:{
height:45,
borderWidth:1,
borderColor:"#CCC",
borderRadius:4,
marginLeft:5,
padding:5,
},
btn:{
width:55,
marginLeft:5,
marginRight:5,
backgroundColor:"blue",
height:45,
justifyContent:"center",
alignItems:"center"
},
search:{
color:"#FFF"
}
});
TextInput的更多相关文章
- React Native 之 TextInput使用
前言 学习本系列内容需要具备一定 HTML 开发基础,没有基础的朋友可以先转至 HTML快速入门(一) 学习 本人接触 React Native 时间并不是特别长,所以对其中的内容和性质了解可能会有所 ...
- react-native 学习之TextInput组件篇
/** * Sample React Native App * https://github.com/facebook/react-native */ 'use strict'; import Rea ...
- react native TextInput
今天我想说一下react native中的一个控件,TextInput 翻译过来就是文本输入,对应着android中的EditText.我们先看一下官方是怎样描述的.TextInput是一个允许用户在 ...
- KnockoutJS 3.X API 第四章 表单绑定(10) textInput、hasFocus、checked绑定
textInput绑定目的 textInput绑定主要用于<input>或者<textarea>元素.他提供了DOM和viewmodel的双向更新.不同于value绑定,tex ...
- React Native 组件之TextInput
React Native 组件之TextInput类似于iOS中的UITextView或者UITextField,是作为一个文字输入的组件,下面的TextInput的用法和相关属性. /** * Sa ...
- [React Native] State and Touch Events -- TextInput, TouchableHighLight
In React, components manage their own state. In this lesson, we'll walk through building a component ...
- Flex TextInput的restrict属性应用
1,<mx:TextInput id="test_ti" width="160" maxChars="20" restrict=&qu ...
- Flex TextInput 动态推断输入内容
Flex TextInput 动态推断输入内容 <? xml version="1.0" encoding="utf-8"?> <s:Appl ...
- 记VUE的v-on:textInput无法执行事件的BUG
<div id="wrap"> <input type="text" v-on:textInput="fn"> &l ...
- React Native随笔——组件TextInput
一.实例 先看一下我要做的搜索框的样子 需要一个Image,和一个TextInput 去掉默认下划线 underlineColorAndroid='transparent' 设置光标颜色 select ...
随机推荐
- 使用avalon实现SKU组合查询功能
SKU(stock keeping unit库存量单位)组合查询是网上商场一个非常常用的功能.具体来说,一件商品会有许多型号,许多颜色,许多产地,许多码寸,而满足用户选中的这些条件的具体商品可能有库存 ...
- 求输出和为n的所有连续自然数序列
这是编程之美中的一道题.编程之美中的题目是这样的: 1+2=3 4+5=9 2+3+4=9 等式的左边都是两个或者两个以上的连续自然数相加,那么是不是所有的整数都可以写成这样的形式? 问题1:写个程序 ...
- elasticsearch2.x插件之一:marvel(配置)
Marvel是Elastic公司推出的商业监控方案,是用来监控Elasticsearch集群,历史状态的有力工具,便于性能优化以及故障诊断.监控主要分为六个层面,分别是集群层.节点层.索引层.分片层. ...
- 用C/C++扩展你的PHP
PHP取得成功的一个主要原因之一是她拥有大量的可用扩展.web开发者无论有何种需求,这种需求最有可能在PHP发行包里找到.PHP发行包包括支持各种数据库,图形文件格式,压缩,XML技术扩展在内的许多扩 ...
- 前端性能分析:分析百度和sogou
先用httpwatch录制这两个网站:www.baidu.com www.sogou.com 由上图可以看到: 百度用时0.278s 发送7831B 接收36620B 13个请求 搜狗 ...
- 125. Valid Palindrome判断有效的有符号的回文串
[抄题]: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ...
- 665. Non-decreasing Array只允许修改一位数的非递减数组
[抄题]: Given an array with n integers, your task is to check if it could become non-decreasing by mod ...
- pt-table-checksum、pt-table-sync核对主从库一致性
一.下载并安装工具http://www.percona.com/downloads/percona-toolkit/目前最新的版本是percona-toolkit_2.2.12.tar.gz上传到服务 ...
- grid search
sklearn.metrics.make_scorer(score_func, greater_is_better=True, needs_proba=False, needs_threshold=F ...
- asp.net web 自定义控件
0.调用代码 protected override void Page_Load(object sender, EventArgs e) { //给基类服务接口复制,可不付 if (IsPostBac ...