this is the first time I have integrated the Google Map on iOS using react-native-maps. I am able to show the Google Map on iOS by following step by step in this link:
react-native-maps with Google Map on iOS
Then, the new problem appear that the performance of the map is terrible (I cannot move a map).
Here is my code:
The region will be saved in state:
constructor(props) {
super(props);
this.state = {
region: {
latitude: 10.762622,
longitude: 106.660172,
latitudeDelta: 0.0100,
longitudeDelta: 0.0100,
},
}
}
Here is the code to show the map:
render() {
return (
<View style={styles.container}>
<View
style={styles.mapContainer}>
<MapView
provider={PROVIDER_GOOGLE}
style={styles.map}
region={this.state.region}
showsUserLocation={true}
onRegionChangeComplete={this.onRegionChangeComplete.bind(this)}
>
</MapView>
</View>
</View>
)
}
onRegionChangeComplete(region) {
console.log("region", region);
this.setState({region: region});
}
These code work fine on Android, but I am not able to move the map on iOS
Please let me know if you have any ideas to solve this problem. Thank you in advance!
So, there are a couple of things I don't like about the code that I think could be bothering you:
So, I would try this:
Also, keep in mind MapView has some props to actually disable the scrolling but I assume you already tried that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With