I have multiple Input elements and everytime the user type into these Inputs I call handleChange() function which should tell what the user has written and which Input he has typed in.
This is what I have done:
handleChange(text, name) {
console.log("test: "text+" "+name);
}
//http://facebook.github.io/react-native/releases/0.23/docs/textinput.html
for (var p = 0; p < 20; p++){
products.push (<TextInput name={p} onChangeText={(text, name) => this.handleChange(text, name)}></TextInput> );
}
the console.log inside handleChange function correctly shows the text written by user but doesn't display correctly name variable which results undefined.
onChangeText{(text, p) => this.handleChange(text, p)}}and see if it works