For example, if we define a TouchableOpacity click event, the method needs to receive a parameter value, as follows
_gotoSubClass(sectionID, rowID) { console.log("sectionID="+sectionID + "rowID=" + rowID); }
Then the onPress attribute of the TouchableOption component should be written like this:
this._gotoSubClass(sectionID, rowID)}> {rowData.title} Copy after login
or
其中bind中的参数1:this代表的是上下文对象,后面跟的参数,对应私有方法中的参数顺序。 {rowData.title}
The above is the detailed content of Detailed explanation of the example code about react native click event. For more information, please follow other related articles on the PHP Chinese website!