这里的意思是说当文本框的内容改变的时候,文本框的输入的内容就会作为一个参数进行传递。因此我们就可以获取到文本框里面的内容就好了。
1 constructor (props) {
2 super (props)
3 this.state = {
4 screen: this.initScreen(),
5 txtValue: null,
6 dataSource: new ListView.DataSource({
7 rowHasChanged: (row1, row2) => row1 !== row2
8 }),
9 loaded: false
10 }
11 }
12
13 。。。。
14
15
16
18 onChangeText={(text) => {
19 this.state.txtValue = text
20 this.getContent()
21 }}
22
23 。。。
24
25 getContent () {
26 ToastAndroid.show(this.state.txtValue, ToastAndroid.LONG)
27 }