我目前正在尝试将 OSM(OpenStreetMap)添加到我的使用 React Native 构建的 Android 应用程序中。然而它仍然显示带有react-native-maps的Google地图
这是我的代码
<View>
<MapView style={styles.map}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 12,
longitudeDelta: 12,
}}
rotateEnabled={false}
zoomEnabled={false}>
<UrlTile
urlTemplate="https://c.tile.openstreetmap.org/{z}/{x}/{y}.png"
shouldReplaceMapContent={true}
maximumZ={19}
flipY={false}
/>
</MapView>
</View>
有人可以帮助我在 Android 应用程序上使用 React Native 来显示 OSM 吗?
另外,package.json是
"dependencies": {
"@expo/html-elements": "latest",
"@gluestack-style/react": "latest",
"@gluestack-ui/themed": "latest",
"@legendapp/motion": "latest",
"@react-native-community/geolocation": "^3.1.0",
"@react-navigation/native": "^6.1.8",
"@react-navigation/native-stack": "^6.9.14",
"expo-font": "^11.6.0",
"expo-location": "^16.3.0",
"install": "^0.13.0",
"leaflet": "^1.9.4",
"npm": "^10.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.72.3",
"react-native-geocoding": "^0.5.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-maps": "1.7.1",
"react-native-paper": "^5.10.6",
"react-native-safe-area-context": "^4.7.2",
"react-native-screens": "^3.25.0",
"react-native-svg": "13.4.0",
"react-native-vector-icons": "^10.0.0"
},
嗨,你能解决这个问题吗?我也有同样的问题