[英]I am trying to style my map to make it darker but its not working
I have tried styling my map by implementing google maps wizards customization JSON, but it is not working I tried different ways to structure the code with no result just the map. 我已经尝试通过实现谷歌地图向导自定义JSON来设计我的地图样式,但它无法正常工作我尝试了不同的方法来构建代码而不仅仅是地图的结果。 Due to the lenght of the code I replaced the JSON code with JSON. 由于代码的长度,我用JSON替换了JSON代码。
I tried different structures and researching solutions. 我尝试了不同的结构和研究解决方案。 Thanks for helping 谢谢你的帮助
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import DrawerNavigator from './Menu/DrawerNavigator'
import MapView from 'react-native-maps';
var region = {
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
};
var mapStyle = JSON
export default class SettingScreen extends React.Component{
render(){
return(
<View style = {styles.container}>
< MapView style = {styles.container}
initialRegion={region}
customMapStyle={mapStyle}/>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#0000',
justifyContent: 'center',
}
});
alright, i have created a styling JSON object as per your instructions and set up an example here . 好吧,我已根据您的说明创建了一个样式JSON对象,并在此处设置了一个示例。 i didnt face an issue with your code, except for a missing semi-colon from the mapStyle
variable. 我没有遇到你的代码问题,除了mapStyle
变量中缺少一个分号。 perhaps, it is the reason why the styling is not loading properly. 也许,这就是为什么样式没有正确加载的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.