class tm extends Component{ constructor(props){ super(props); this.state ={text:''} } render(){ return( <View style={{padding: 10}}> <TextInput style={{height: 40}} placeholder="请输入账号" onChangeText={(text) => this.setState({text})} /> <Text style={{padding: 10, fontSize: 42}}> {this.state.text.split('').map((word)=>word).join('')} </Text> </View> ); }; }
转载于:https://my.oschina.net/u/2355512/blog/1476136