TextInput 是一个允许用户输入文本的基础组件,它又一个onChangeText的属性,改属性接受一个函数,每当文本输入发生变化时,此函数就会被调用。它还有一个onSubmitEditing的属性,当文本输入完被提交的时候调用。
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Component} from 'react';
import {
Platform,
StyleSheet,
Text,
View,
TextInput,
} from 'react-native';
export default class App extends Component {
render() {
return (
添加账号
登 录
无法登录?
新用户
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
header:{
height:50,
backgroundColor:'#12B7F5',
justifyContent:'center'
},
headtitle:{
alignSelf:'center',
fontSize:20,
color:'white'
},
avatarview:{
height:150,
backgroundColor:'#ECEDF1',
justifyContent:'center'
},
avatarimage:{
height:15,
backgroundColor:'#F7F7F9'
},
marginTopview: {
height: 15,
backgroundColor: '#F7F7F9'
},
inputview: {
height: 100,
},
textinput: {
flex: 1,
fontSize: 16,
},
dividerview: {
flexDirection: 'row',
},
divider: {
flex: 1,
height: 1,
backgroundColor: '#ECEDF1'
},
bottomview: {
backgroundColor: '#ECEDF1',
flex: 1,
},
buttonview: {
backgroundColor: '#1DBAF1',
margin: 10,
borderRadius: 6,
justifyContent: 'center',
alignItems: 'center',
},
logintext: {
fontSize: 17,
color: '#FFFFFF',
marginTop: 10,
marginBottom: 10,
},
emptyview: {
flex: 1,
},
bottombtnsview: {
flexDirection: 'row',
},
bottomleftbtnview: {
flex: 1,
height: 50,
paddingLeft: 10,
alignItems: 'flex-start',
justifyContent: 'center',
},
bottomrightbtnview: {
flex: 1,
height: 50,
paddingRight: 10,
alignItems: 'flex-end',
justifyContent: 'center',
},
bottombtn: {
fontSize: 15,
color: '#1DBAF1',
}
});