I'm trying to use a if
like this:
<Button
iconRight={{
name: 'search',
type: 'font-awesome'
}}
title='BUSCAR'
buttonStyle={{
marginTop: 15,
borderRadius: 7,
backgroundColor:'#2C5CAA'
}}
onPress={(function() {if (this.state.busca.length > 0){
alert(this.state.busca.length);
}else{
this.props.navigation.navigate('Lista', {
busca: this.state.busca,
city: this.state.city })}
})
}
/>
However, I'm getting an error in the variable this.state.busca
:
undefined is not an object (evaluating 'this.state.search')
How to solve?