简体   繁体   English

反应本机地图集成

[英]React native map integration

I am trying to integrate map in react native. 我正在尝试将地图集成到React Native中。 I am following the below tutorial. 我正在关注以下教程。 https://github.com/airbnb/react-native-maps https://github.com/airbnb/react-native-maps

I gone through all the installation instruction. 我仔细阅读了所有安装说明。 I am using react-native version : 0.44.0 and react-native-map version : 0.13.0 I made sure that react-native-link is linked with android and iOS. 我正在使用react-native version : 0.44.0react-native-map version : 0.13.0我确保react-native-link与android和iOS链接。 While rendering the mapview in ios simulator, map is not showing and only i am able to a blank map with red outline. 在ios模拟器中渲染mapview时,地图未显示,只有我能够绘制带有红色轮廓的空白地图。

Please check my below code and let me know, where i am wrong. 请检查我下面的代码,让我知道我错了。

var MapView = require('react-native-maps');
<MapView
    initialRegion={{
    latitude: 37.78825,
    longitude: -122.4324,
    latitudeDelta: 0.0922,
    longitudeDelta: 0.0421,
    }}
/>

Try adding a View and some heights and ...StyleSheet.absoluteFillObject 尝试添加一个View以及一些高度和... StyleSheet.absoluteFillObject

<View style={{height:400}}>
    <MapView 
         style={{ ...StyleSheet.absoluteFillObject,height:400 }}
         initialRegion={{
             latitude: 37.78825,
             longitude: -122.4324,
             latitudeDelta: 0.0922,
             longitudeDelta: 0.0421,
         }}
    />
</View>

请记住,将您的Google Maps API密钥包含在AndroidManifest.xml中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM