So here is the code:
export default SomeClass extends React.Component {
constructor(props) {
super(props);
}
_FunctionA = () => {
// Do something
}
render() {
const arr = ['1', '2'];
const buttons = arr.map(function(v, i) {
return(
<TouchableOpacity onPress={this._FunctionA}></TouchableOpacity>
);
});
return(
<View>
{ buttons }
</View>
);
}
}
My problem is why can't I call functionA in the same class inside the map function, I know that there is a problem with this._FunctionA which is not referring to the correct function, but I could not find how and what is the method to call the Function from the map function.