• Stars
    star
    317
  • Rank 132,216 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Google Maps component for React.js

Build Status

React Gmaps

A Google Maps component for React.js

Features

  • Lazy Google Maps loading
  • Easy to use

Installation

$ npm install react-gmaps --save

Demo

http://react-gmaps.herokuapp.com/

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import {Gmaps, Marker, InfoWindow, Circle} from 'react-gmaps';

const coords = {
  lat: 51.5258541,
  lng: -0.08040660000006028
};

const params = {v: '3.exp', key: 'YOUR_API_KEY'};

class App extends React.Component {

  onMapCreated(map) {
    map.setOptions({
      disableDefaultUI: true
    });
  }

  onDragEnd(e) {
    console.log('onDragEnd', e);
  }

  onCloseClick() {
    console.log('onCloseClick');
  }

  onClick(e) {
    console.log('onClick', e);
  }

  render() {
    return (
      <Gmaps
        width={'800px'}
        height={'600px'}
        lat={coords.lat}
        lng={coords.lng}
        zoom={12}
        loadingMessage={'Be happy'}
        params={params}
        onMapCreated={this.onMapCreated}>
        <Marker
          lat={coords.lat}
          lng={coords.lng}
          draggable={true}
          onDragEnd={this.onDragEnd} />
        <InfoWindow
          lat={coords.lat}
          lng={coords.lng}
          content={'Hello, React :)'}
          onCloseClick={this.onCloseClick} />
        <Circle
          lat={coords.lat}
          lng={coords.lng}
          radius={500}
          onClick={this.onClick} />
      </Gmaps>
    );
  }

};

ReactDOM.render(<App />, document.getElementById('gmaps'));

Test

$ npm test

More Repositories

1

css-in-js

React: CSS in JS techniques comparison
JavaScript
5,530
star
2

react-fix-it

Automagically generate tests from errors
JavaScript
1,911
star
3

react-automata

A state machine abstraction for React
JavaScript
1,338
star
4

react-design-patterns-and-best-practices

React Design Patterns and Best Practices
JavaScript
198
star
5

react-worker

Using Service Workers to render React components
JavaScript
187
star
6

react-count-to

Animated counter component for React.js
Dockerfile
61
star
7

jquery-html5-uploader

jQuery drag&drop file uploader
JavaScript
57
star
8

react-poop

The ultimate error handler for React
JavaScript
56
star
9

react-only-if

Render a React.js component only if
JavaScript
49
star
10

postcss-composes

PostCSS plugin to make CSS Modules' composes work with any selectors
JavaScript
26
star
11

react-render-with-params

The render method you've always wanted
JavaScript
24
star
12

emoji-reporter

❀️ The best mocha reporter ever
JavaScript
23
star
13

react-data-provider

Because the Context is too mainstream
JavaScript
18
star
14

atomic-css-modules

15
star
15

babel-plugin-react-fix-it

Babel plugin for react-fix-it
JavaScript
15
star
16

grunt-po2mo

Compile .po files into binary .mo files with msgfmt.
JavaScript
14
star
17

react-test-perf

React test runners performance benchmark
JavaScript
11
star
18

proper-error-handling

JavaScript
11
star
19

react-payment-request

A Payment Request component for React.js
JavaScript
11
star
20

DotFuzzy

Open Source Fuzzy Logic Library
C#
9
star
21

old

Skype and Tumblr integration
JavaScript
6
star
22

PagOnline

Italian Unicredit PagOnline Payment Gateway for WP e-Commerce
PHP
6
star
23

dirty-markup

Automatically remove inline CSS styles from your HTML
JavaScript
4
star
24

basscss-modules

It's just me playing with Basscss and CSS Modules
JavaScript
2
star
25

react-speech

Speech Recognition mixin for React.js
JavaScript
2
star
26

BusDepartureBoardApp

OutOfView's coding challenge
JavaScript
1
star
27

JobCreation

Bizzby's coding challenge
JavaScript
1
star
28

brainpirlo

Playing with Backbone.js
JavaScript
1
star
29

css-modules-extractor

Extractor library for CSS Modules Compiler
JavaScript
1
star