react-leaflet
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -14,3 +14,5 @@ var React = require("react"); | ||
url: React.PropTypes.string.isRequired, | ||
bounds: boundsType.isRequired | ||
bounds: boundsType.isRequired, | ||
opacity: React.PropTypes.number, | ||
attribution: React.PropTypes.string | ||
}, | ||
@@ -23,2 +25,11 @@ | ||
componentDidUpdate:function(prevProps) { | ||
if (this.props.url !== prevProps.url) { | ||
this.getLeafletElement().setUrl(this.props.url); | ||
} | ||
if (this.props.opacity !== prevProps.opacity) { | ||
this.getLeafletElement().setOpacity(this.props.opacity); | ||
} | ||
}, | ||
render:function() { | ||
@@ -25,0 +36,0 @@ return null; |
@@ -23,7 +23,7 @@ var React = require("react"); | ||
componentDidUpdate:function(prevProps) { | ||
var $__0= this.props,children=$__0.children,map=$__0.map,popupContainer=$__0.popupContainer,position=$__0.position; | ||
var $__0= this.props,children=$__0.children,map=$__0.map,popupContainer=$__0.popupContainer,position=$__0.position,props=(function(source, exclusion) {var rest = {};var hasOwn = Object.prototype.hasOwnProperty;if (source == null) {throw new TypeError();}for (var key in source) {if (hasOwn.call(source, key) && !hasOwn.call(exclusion, key)) {rest[key] = source[key];}}return rest;})($__0,{children:1,map:1,popupContainer:1,position:1}); | ||
if (children !== prevProps.children) { | ||
var content = React.renderToStaticMarkup(children); | ||
if (popupContainer) { | ||
popupContainer.bindPopup(content); | ||
popupContainer.bindPopup(content, props); | ||
} | ||
@@ -43,3 +43,3 @@ else { | ||
render:function() { | ||
var $__0= this.props,children=$__0.children,map=$__0.map,popupContainer=$__0.popupContainer,position=$__0.position; | ||
var $__0= this.props,children=$__0.children,map=$__0.map,popupContainer=$__0.popupContainer,position=$__0.position,props=(function(source, exclusion) {var rest = {};var hasOwn = Object.prototype.hasOwnProperty;if (source == null) {throw new TypeError();}for (var key in source) {if (hasOwn.call(source, key) && !hasOwn.call(exclusion, key)) {rest[key] = source[key];}}return rest;})($__0,{children:1,map:1,popupContainer:1,position:1}); | ||
if (children) { | ||
@@ -52,3 +52,3 @@ if (React.Children.count(children) > 1) { | ||
if (popupContainer) { | ||
popupContainer.bindPopup(content); | ||
popupContainer.bindPopup(content, props); | ||
return null; | ||
@@ -55,0 +55,0 @@ } |
{ | ||
"name": "react-leaflet", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "React components for Leaflet maps", | ||
@@ -15,2 +15,3 @@ "main": "lib/index.js", | ||
"keywords": [ | ||
"react-component", | ||
"react", | ||
@@ -27,17 +28,18 @@ "leaflet", | ||
"dependencies": { | ||
"leaflet": "^0.7.3", | ||
"lodash-node": "^2.4.1" | ||
}, | ||
"peerDependencies": { | ||
"leaflet": "^0.7.0", | ||
"react": "^0.12.0" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^8.1.0", | ||
"browserify": "^8.1.1", | ||
"del": "^1.1.1", | ||
"gulp": "^3.8.10", | ||
"gulp-load-plugins": "^0.7.1", | ||
"gulp-load-plugins": "^0.8.0", | ||
"gulp-react": "^2.0.0", | ||
"gulp-util": "^3.0.1", | ||
"gulp-webserver": "^0.9.0", | ||
"jest-cli": "^0.1.18", | ||
"jest-cli": "^0.2.1", | ||
"leaflet": "^0.7.3", | ||
"react": "^0.12.2", | ||
@@ -44,0 +46,0 @@ "react-tools": "^0.12.2", |
@@ -17,2 +17,8 @@ React-Leaflet | ||
React and Leaflet are peer dependencies, if you haven't already installed them use: | ||
```bash | ||
npm install leaflet react react-leaflet | ||
``` | ||
## Getting started | ||
@@ -74,5 +80,7 @@ | ||
**Bounds**: An instance of *Leaflet.LatLngBounds* or a *LatLngList*. | ||
### Events | ||
Leaflet exposes its own events, different from React. You can listen to them using React-Leaflet by adding a callback to a property prefixed by `onLeaflet`. Ex: `<Map onLeafletMovend={this.handleMoved}>...</Map>`. | ||
Leaflet exposes its own events, different from React. You can listen to them using React-Leaflet by adding a callback to a property prefixed by `onLeaflet`. Ex: `<Map onLeafletMoveend={this.handleMoveend}>...</Map>`. | ||
Check Leaflet documentation for the events associated to each component. | ||
@@ -94,3 +102,3 @@ | ||
- `id` (optional String): The ID of the `<div>` container for the map. If you don't provide it, a unique one will be created. | ||
- `maxBounds` (optional LatlngList) | ||
- `maxBounds` (optional Bounds) | ||
- `maxZoom` (optional Number) | ||
@@ -120,2 +128,8 @@ - `minZoom` (optional Number) | ||
##### ImageOverlay | ||
- `url` (required String, dynamic) | ||
- `opacity` (optional Number, dynamic) | ||
- `attribution` (optional String) | ||
##### Implemented but needing testing and documentation | ||
@@ -125,3 +139,2 @@ | ||
- WMSTileLayer | ||
- ImageOverlay | ||
@@ -158,3 +171,3 @@ #### Vector Layers | ||
- `bounds` (required LatLngList, dynamic) | ||
- `bounds` (required Bounds, dynamic) | ||
@@ -161,0 +174,0 @@ #### Other Layers |
30819
579
179
14
- Removedleaflet@^0.7.3