React-Native:Google地图仅显示徽标,米色背景和makter

时间:2017-11-30 14:06:53

标签: android google-maps react-native

我正在努力让Google地图在React-Native中工作,但我只是走得很远:

What I have so far

我的代码:

    import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View } from 'react-native';
import MapView from 'react-native-maps';

class Additional extends Component {
render() {
  return (
<View style={styles.container}>

    <MapView style={styles.map}
        region={{
            latitude: 4.895168,
            longitude: 52.370216,
            latitudeDelta: 0.1,
            longitudeDelta: 0.1,
        }}
    >

    <MapView.Marker
        coordinate={{
            latitude: 4.895168,
            longitude: 52.370216
            }}
            title={"titel"}
            description={"descriptie"}
            />
    </MapView>
</View>
  );
      }
}



Additional.navigationOptions = {
  title: 'Second Screen Title',
};


const styles = StyleSheet.create({
  container: {
        flex: 1,
        position: 'absolute',
        top: 0,
        left: 0,
        bottom: 0,
        right: 0,
        justifyContent: 'flex-end',
        alignItems: 'center',
  },
  map: {
      position: 'absolute',
      top: 0,
      left: 0,
      bottom: 0,
      right: 0
  },
});




export default Additional;

我已经按照本教程了解了api密钥并添加了谷歌地图: Tutorial

这是我的第二页,另一页是使用weather-api。 但根据实时调试器,没有什么是冲突的。

有谁知道发生了什么事?谢谢!

编辑/附加信息: 我已经在google-api网页上激活了我的API。

编辑/附加信息: My androidmanifest

1 个答案:

答案 0 :(得分:0)

我错过了一堆权限:

<permission      android:name="com.shop.shoppinglist.permission.MAPS_RECEIVE" 
 android:protectionLevel="signature"/>
<uses-permission android:name="com.shop.addtask.permission.MAPS_RECEIVE"/>
<uses-permission 
 android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>