-1
I got my construtor
:
constructor(props) {
super(props);
this.state = {
categorias: [],
refreshing: true
}
this.buscarSubcategorias = this.buscarSubcategorias.bind(this);
}
And the function:
buscarSubcategorias(categoria_id) {
alert(categoria_id);
}
And on my button I have:
<TouchableHighlight key={ item.id } onPress={ () => { this.buscarSubcategorias(item.id) }}>
<Text style={ styles.txtLinks }>{ item.nome }</Text>
</TouchableHighlight>
But when clicking I get the following error:
Undefined is not a Function (evaluating '_this3.searchSubcategories(item.id)')
Yes, this responds. If it removes . bind in the constructor it ceases to receive Undefined.
– Ericson Willians