简体   繁体   English

我试图设计我的地图以使其更暗,但它不起作用

[英]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. 也许,这就是为什么样式没有正确加载的原因。

@kenmistry you are actually having the same result I have, usually, it should show a map with a dark blueish background what I got from your code same as mine is a standard map. @kenmistry你实际上我有相同的结果,通常,它应该显示一个深蓝色背景的地图我从你的代码得到的同样我的是一个标准的地图。 er is the screenshot: 呃是截图: 在此输入图像描述

暂无
暂无

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

相关问题 我正在尝试删除 btn 但它不起作用 - I am trying to make delete btn but its not working 我试图更好地查看我的动态分页,但它不起作用 - I am trying to give better look to my dynamic pagination but its not working 我正在尝试使用 this.SetState() 更改我的组件的 state,但它不起作用 - i am trying to change the state of my component with this.SetState(), but its no working 我正在尝试使数组[i]“发光”分配的顺序。 为什么我的代码不起作用? - I am trying to make an array[ i ] 'glow' in order assigned. Why is my code not working? 我试图弄清楚如何让我的函数一个接一个地运行……但是它不起作用 - I am trying to figure out how to make my functions run one after another… but it is not working 结果按钮不起作用 我正在尝试为条件语句制作程序,但我的代码不起作用 - the result button wont work I am trying to make program for conditional statement but my codes are not working 我正在尝试使div幻灯片加载,而我以前的解决方案不再起作用? - I am trying to make a div slide in on load and my previous solution is no longer working? 我正在尝试使用javascript更改链接的颜色并且它不起作用 - I am trying to change the color of link using javascript and its not working 我正在尝试使用反应钩子 useContext() 但它不起作用 - I am trying to use the react hook useContext() but its not working 我试图在同一页面上有第二个 slider 但它不起作用 - I am trying to have a second slider on the same page but its not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM