React native学习第六章:TextInput

    xiaoxiao2021-03-25  116

    TextInput是一个允许用户输入文本的基础组件。它有一个名为onChangeText的属性,此属性接受一个函数,而此函数会在文本变化时被调用。另外还有一个名为onSubmitEditing的属性,会在文本被提交后(用户按下软键盘上的提交键)调用。

    class TestTextInput extends Component{ constructor(props) { super(props); this.state = {text2: ''}; } render() { return ( <View style={{padding: 10}}> <TextInput style={{height: 40}} placeholder="Type here to translate!" onChangeText={(text2) => this.setState({text2})} /> <Text style={{padding: 10, fontSize: 42}}> {this.state.text2.split(' ').map((word) => word && '

    转载请注明原文地址: https://ju.6miu.com/read-10238.html

    最新回复(0)