close
答:
另寫一個function出來接收多個參數
onChangeText去呼叫這個參數,並且帶入自訂參數即可
ex:
onChangeText={(text) => this.handleChange(text, p)}
--
What is name
supposed to be? All you're doing is setting name to an integer, but here's a way to make it work:
handleChange(text, name) {
console.log("test: "text+" "+name);
}
//http://facebook.github.io/react-native/releases/0.23/docs/textinput.html
for (let p = 0; p < 20; p++){
products.push (<TextInput onChangeText={(text) => this.handleChange(text, p)}></TextInput> );
}
--
全站熱搜
留言列表