Why is this onPress activated at any time without pressing TouchableOpacity when I change any property of state if project_id is not null?
<TouchableOpacity
onPress={() => {
if (this.state.feedback.project_id != null) {
this.setModalVisible(true);
} else {
Alert.alert('Select a project please');
}
}}>
<View>
<Text>SEND NOW</Text>
</View>
</TouchableOpacity>
Example process:
- I press this touchable and project_id == 1 , modal will open.
- I close the modal
- I change feedback.name with a textinput
- Because project_id is still 1 modal will open