[英]react native - react-native-maps performance slow on iOS
這是我第一次使用react-native-maps
在 iOS 上集成谷歌地圖。 我可以通過此鏈接中的逐步操作在 iOS 上顯示 Google 地圖:
在 iOS 上使用 Google Maps react-native-maps
然后,新的問題出現了,地圖的性能很糟糕(我不能移動地圖)。
這是我的代碼:
該區域將保存在以下狀態:
constructor(props) {
super(props);
this.state = {
region: {
latitude: 10.762622,
longitude: 106.660172,
latitudeDelta: 0.0100,
longitudeDelta: 0.0100,
},
}
}
這是顯示地圖的代碼:
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});
}
這些代碼在 Android 上運行良好,但我無法在 iOS 上移動地圖
如果您有解決此問題的任何想法,請告訴我。 先感謝您!
所以,我不喜歡代碼的一些事情,我認為可能會打擾你:
所以,我會試試這個:
另外,請記住 MapView 有一些道具可以實際禁用滾動,但我假設您已經嘗試過。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.