[英]React-Native: Google maps only showing the logo, beige background and the makter
I am trying to get Google Maps to work in React-Native, but I'm only getting this far: 我试图让Google Maps可以在React-Native中使用,但是我只是走得很远:
My code: 我的代码:
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;
I have followed this tutorial for the api key and adding google maps: Tutorial 我已经按照本教程的api键添加了Google Maps: 教程
This is my second page, the other one page is using a weather-api. 这是我的第二页,另一页正在使用天气API。 But according to the live-debugger nothing is conflicting.
但是据现场调试器称,没有什么冲突。
Does anyone know what's going on? 有人知道发生了什么吗? Thanks!
谢谢!
Edit/additional information: I have activated my API on the google-api webpage. 编辑/其他信息:我已经在google-api网页上激活了我的API。
Edit/additional information: My androidmanifest 编辑/其他信息: 我的androidmanifest
I was missing a bunch of permissions: 我缺少一堆权限:
<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"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.