Skip to content

Commit

Permalink
Merge pull request #8 from andywer/master
Browse files Browse the repository at this point in the history
Fix popup loosing options on `popupContainer.bindPopup()`
  • Loading branch information
PaulLeCam committed Jan 19, 2015
2 parents bbac20a + 59cf9ad commit 388271a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions example/build/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ module.exports = React.createClass({
},

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);
}
else {
var el = this.getLeafletElement();
Expand All @@ -415,15 +415,15 @@ module.exports = React.createClass({
},

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) {
if (React.Children.count(children) > 1) {
children = React.createElement("span", null, children);
}
var content = React.renderToStaticMarkup(children);
// Attach to container component
if (popupContainer) {
popupContainer.bindPopup(content);
popupContainer.bindPopup(content, props);
return null;
}
// Attach to a Map
Expand Down
8 changes: 4 additions & 4 deletions lib/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ module.exports = React.createClass({
},

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);
}
else {
var el = this.getLeafletElement();
Expand All @@ -39,15 +39,15 @@ module.exports = React.createClass({
},

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) {
if (React.Children.count(children) > 1) {
children = React.createElement("span", null, children);
}
var content = React.renderToStaticMarkup(children);
// Attach to container component
if (popupContainer) {
popupContainer.bindPopup(content);
popupContainer.bindPopup(content, props);
return null;
}
// Attach to a Map
Expand Down
8 changes: 4 additions & 4 deletions src/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ module.exports = React.createClass({
},

componentDidUpdate(prevProps) {
var {children, map, popupContainer, position} = this.props;
var {children, map, popupContainer, position, ...props} = this.props;
if (children !== prevProps.children) {
var content = React.renderToStaticMarkup(children);
if (popupContainer) {
popupContainer.bindPopup(content);
popupContainer.bindPopup(content, props);
}
else {
var el = this.getLeafletElement();
Expand All @@ -39,15 +39,15 @@ module.exports = React.createClass({
},

render() {
var {children, map, popupContainer, position} = this.props;
var {children, map, popupContainer, position, ...props} = this.props;
if (children) {
if (React.Children.count(children) > 1) {
children = <span>{children}</span>;
}
var content = React.renderToStaticMarkup(children);
// Attach to container component
if (popupContainer) {
popupContainer.bindPopup(content);
popupContainer.bindPopup(content, props);
return null;
}
// Attach to a Map
Expand Down

0 comments on commit 388271a

Please sign in to comment.