FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

opuslabs/react-google-map: React component to render a map with markers from Google Maps API · GitHub

 
 

Repository files navigation

react-google-map

React component to render a map with markers from Google Maps API

Install

npm install --save react-google-map

Changelog

See changelog

Demo

http://cedricdelpoux.github.io/react-google-map/

Usage

import React, { Component } from 'react'
import GoogleMap from 'react-google-map'

export default class MyComponent extends Component {
  state = {
    coordinates: [],
    zoom: 8,
  }

  handleMapChange(coordinates, zoom) {
      this.setState({ coordinates, zoom })
    }

  render() {
    const { coordinates, zoom } = this.state

    return (
      <GoogleMap
        coordinates={ coordinates }
        zoom={ zoom }
        onChange={ (coordinates, zoom) => this.handleMapChange(coordinates, zoom) }
      />
    )
  }
}

Props

  • coordinates: Array of objects with shape { description: String, latitude: Number, longitude: Number, title: String } - by default is []
  • defaultLat: Number,
  • defaultLng: Number,
  • googleMaps: Object - injected by decorator,
  • onChange: Function with two parameters (New coordinates object, actual zoom),
  • zoom: Number - isRequired,

Classes

  • .googleMap

Development

Clean lib folder

npm run clean

Build lib folder

npm run build

Watch src folder

npm run watch

Lint src folder

npm run lint

License

See MIT

About

React component to render a map with markers from Google Maps API

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages


Back | FazBrowse Home | New Git URL