![](/img/trans.png)
[英]React-Native-Maps: Map is empty. Only shows Google logo and Marker
[英]How to fix brown map with a logo of google using the (react-native-maps)
我是新開發的react-native,現在有基於該位置(緯度和經度)跟蹤所有用戶的模塊。 我開始安裝npm install react-native-maps --save,安裝很好,現在我開始在Android上進行Build配置
注意:我使用手機運行該應用程序
題:
1.這適用於所有設備嗎?
2.API密鑰有問題嗎?
3.它是反應原生地圖的問題版本嗎?
我只是按照文檔中的配置。 https://github.com/react-native-community/react-native-maps/blob/master/docs/installation.md
現在,我開始在
https://console.cloud.google.com
現在在我的AndroidManifest.xml中
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
包= “com.tracker”>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data android:name="com.google.android.geo.API_KEY" android:value="Keep Secret first"/>
</application>
在我的app.js中
進口
import MapView from 'react-native-maps';
返回
<View style={styles.container}>
<MapView style = {styles.mapcontainer}
showsUserLocation={true}
showsMyLocationButton={false}
zoomEnabled = {true}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}} >
</MapView>
</View>
CSS
const styles = StyleSheet.create({
container: {
flex: 1,
},
mapcontainer: {
flex: 1,
...StyleSheet.absoluteFillObject
},
});
調試器看起來像這樣
我希望有人可以幫我解決這個問題。 謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.