We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I'm using the Custom Styling Wizard to get the silver style map. However, when I try to implement the JSON file to my project, it doesn't work.
This is my file:
// Packages import React, {Component} from 'react'; import GoogleMapReact from 'google-map-react'; export default class Map extends Component { static defaultProps = { center: {lat: 51.909490, lng: 6.384903}, zoom: 8, styles: require('../../constants/mapStyles') } render() { return ( <div className='google-map' style={{height: '100vh', width: '100%'}}> <GoogleMapReact bootstrapURLKeys={{key: 'AIzaSyClAqaUdtOKdG6zyT8wSNkuBhm1iOcfaVw'}} defaultCenter={this.props.center} defaultZoom={this.props.zoom} defaultOptions={this.props.styles}> </GoogleMapReact> </div> ) } }
The text was updated successfully, but these errors were encountered:
DId you try: defaultOptions={{ styles: this.props.styles }}?
defaultOptions={{ styles: this.props.styles }}
options accepts an object, you are probably passing the mapStyles array directly, without key.
options
Sorry, something went wrong.
@johanlef I've tried. Nothing works..
mapStyles.js:
mapStyles.js
export default [ { elementType: "geometry", stylers: [ { color: "#f5f5f5", }, ], }, // ... ];
import styles from "./mapStyles"; <GoogleMapReact bootstrapURLKeys={{ key: GOOGLE_MAPS_API_KEY }} options={{ styles }} > {/* your markers */} </GoogleMapReact>
or options={{ styles: styles }}
options={{ styles: styles }}
works perfectly :)
No branches or pull requests
Hello,
I'm using the Custom Styling Wizard to get the silver style map. However, when I try to implement the JSON file to my project, it doesn't work.
This is my file:
The text was updated successfully, but these errors were encountered: