I am using react-native-map and want to make different buttons inside callout view but onPress is not working inside it. I am using a callout inside the marker. If any has a workaround to solve this please let me know.
Here is my code:
export default class MapTest extends Component {
constructor(props) {
super(props);
this.state = {
}
render() {
return (
<View style={{ flex: 1 }}>
<MapView
style={styles.map}
region={{
latitude: this.state.lat,
longitude: this.state.long,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
showsUserLocation={true}
>
<Marker
ref={ref => { this.mark = ref; }}
coordinate={{
latitude: this.state.lat,
longitude: this.state.long
}}
title={this.state.formatted_address}
description='View Details'>
<Callout>
<View style={{marginTop: 15, flex: 1}}>
<Text style={{fontWeight: "bold"}}>{this.state.Title}</Text>
</View>
<TouchableOpacity style={{marginTop: 15, flex: 1}} onPress={() => {console.log('this is not working!')}}>
<Text style={{fontWeight: "bold"}}>Details</Text>
</TouchableOpacity>
</Callout>
</Marker>
</MapView>
</View>
);
}
}