react-googlemaps
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -0,1 +1,7 @@ | ||
## 0.3.0 | ||
- Removed `getNodeInterface` and added `getMapNode` which returns the real internal map class instance rather than an interface. | ||
- Added API docs and more detailed examples. | ||
- Added `Frag` component. | ||
## 0.2.1 | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "react-googlemaps", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "A declarative React interface to Google Maps", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -6,2 +6,8 @@ React Google Maps [![Build Status](https://travis-ci.org/pieterv/react-googlemaps.svg?branch=master)](https://travis-ci.org/pieterv/react-googlemaps) | ||
Check it out: | ||
* [Example usage](examples) | ||
* [API docs](docs/api.md) | ||
* [What's new](CHANGELOG.md) | ||
Important Notes | ||
@@ -17,3 +23,3 @@ --------------- | ||
```sh | ||
npm install react-googlemaps | ||
npm install react-googlemaps --save | ||
``` | ||
@@ -25,13 +31,42 @@ | ||
Components | ||
-------- | ||
Usage | ||
----- | ||
- Map | ||
- Marker | ||
- Polyline | ||
- Circle | ||
- Rectangle | ||
- Polygon | ||
- OverlayView | ||
```js | ||
var React = require('react'); | ||
var ReactGoogleMaps = require('react-googlemaps'); | ||
var GoogleMapsAPI = window.google.maps; | ||
Check out the [`examples`](https://github.com/pieterv/react-googlemaps/tree/master/examples) directory to see how these modules can be used. | ||
var Map = ReactGoogleMaps.Map; | ||
var Marker = ReactGoogleMaps.Marker; | ||
var OverlayView = ReactGoogleMaps.OverlayView; | ||
function handleClick(e) { | ||
console.log('Clicked at position', e.latLng); | ||
} | ||
React.renderComponent( | ||
<Map | ||
initialZoom={10} | ||
initialCenter={new GoogleMapsAPI.LatLng(-41.2864, 174.7762)}> | ||
<Marker | ||
onClick={handleClick} | ||
position={new GoogleMapsAPI.LatLng(-41.2864, 174.7762)} /> | ||
<OverlayView | ||
style={{backgroundColor: '#fff'}} | ||
position={new GoogleMapsAPI.LatLng(-41.2864, 174.7762)}> | ||
<p>Some content</p> | ||
</OverlayView> | ||
</Map>, | ||
mountNode | ||
); | ||
``` | ||
Checkout the [API docs](docs/api.md) or the [`examples`](examples) directory for more detailed usage. | ||
License | ||
------- | ||
Licensed under MIT. [Full license here »](LICENSE) |
@@ -46,3 +46,3 @@ "use strict"; | ||
return listener(event, instance.getNodeInterface()); | ||
return listener(event, instance.getMapNode()); | ||
} | ||
@@ -49,0 +49,0 @@ }; |
@@ -90,4 +90,7 @@ "use strict"; | ||
var listener = instance.props[eventName]; | ||
instance.queueDirtyCheck(); | ||
var returnVal = listener(instance.getNodeInterface()); | ||
var returnVal; | ||
if (listener) { | ||
instance.queueDirtyCheck(); | ||
returnVal = listener(instance.getMapNode()); | ||
} | ||
instance.flushDirtyChangesTo(effects); | ||
@@ -94,0 +97,0 @@ |
@@ -28,3 +28,3 @@ "use strict"; | ||
return listener(instance.getNodeInterface()); | ||
return listener(instance.getMapNode()); | ||
} | ||
@@ -31,0 +31,0 @@ }; |
@@ -29,2 +29,3 @@ "use strict"; | ||
// OverlayView: Note: Injected, see `ReactOverlayView`. | ||
// Frag: Note: Injected, see `ReactFrag`. | ||
}, createMapComponentClass); | ||
@@ -31,0 +32,0 @@ |
@@ -10,2 +10,3 @@ /** @jsx React.DOM */ | ||
var PropTypeUtils = require('../../utils/PropTypeUtils'); | ||
var ReactFrag = require('./ReactFrag'); | ||
@@ -55,16 +56,18 @@ var GoogleMapsMap = ReactMapComponents.Map; | ||
if (this.state.mapLifeCycleState !== MapLifeCycle.CREATING_HOLDER) { | ||
map = this.transferPropsTo(<GoogleMapsMap ref="map" mapDiv={this.refs.mapHolder.getDOMNode()} width={null} height={null} />); | ||
map = this.transferPropsTo( | ||
<GoogleMapsMap | ||
ref="map" | ||
mapDiv={this.refs.mapHolder.getDOMNode()} | ||
width={null} | ||
height={null} /> | ||
); | ||
} | ||
// Check if there is an instance of a Google Map first | ||
// Loop through each child adding the `this.__node` object | ||
// to their props, this will allow the children to be injected | ||
// into this map instance. | ||
var children; | ||
if (!this.state.mapLifeCycleState) { | ||
var mapProps = {map: this.refs.map.__node}; | ||
children = React.Children | ||
.map(this.props.children, function(child) { | ||
return React.isValidComponent(child) ? cloneWithProps(child, mapProps) : child; | ||
}); | ||
children = ( | ||
<ReactFrag map={this.refs.map.__node}> | ||
{this.props.children} | ||
</ReactFrag> | ||
); | ||
} | ||
@@ -71,0 +74,0 @@ |
@@ -9,2 +9,3 @@ "use strict"; | ||
var ReactOverlayView = require('./components/ReactOverlayView'); | ||
var ReactFrag = require('./components/ReactFrag'); | ||
var SimpleEventPlugin = require('../eventPlugins/SimpleEventPlugin'); | ||
@@ -30,3 +31,4 @@ var MouseEventPlugin = require('../eventPlugins/MouseEventPlugin'); | ||
Map: ReactMap, | ||
OverlayView: ReactOverlayView | ||
OverlayView: ReactOverlayView, | ||
Frag: ReactFrag | ||
}); | ||
@@ -33,0 +35,0 @@ |
@@ -9,3 +9,2 @@ "use strict"; | ||
var GoogleMapsAPI = require('../GoogleMapsAPI'); | ||
var GetterProxy = require('../utils/GetterProxy'); | ||
@@ -42,3 +41,2 @@ /** | ||
this.__node = this.constructGoogleMapsClass(); | ||
this.__nodeInterface = new GetterProxy(this.__node); | ||
this._setInitialMapProperties(); | ||
@@ -155,3 +153,2 @@ this._updateMapProperties(emptyPropsCache); | ||
this.__node = null; | ||
this.__nodeInterface = null; | ||
}, | ||
@@ -195,4 +192,4 @@ | ||
getNodeInterface: function() { | ||
return this.__nodeInterface; | ||
getMapNode: function() { | ||
return this.__node; | ||
} | ||
@@ -199,0 +196,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1007
70
40883
25