Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ignored events when there is an attribute named "length" in a layer #41

Merged
merged 2 commits into from
Jun 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions example/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ export default class EventsExample extends Component {
center={this.state.latlng}
zoom={13}
onClick={this.handleClick.bind(this)}
onLocationfound={this.handleLocationFound.bind(this)}>
onLocationfound={this.handleLocationFound.bind(this)}
length={4}>
<TileLayer
url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'
attribution='&copy; <a href='http://osm.org/copyright'>OpenStreetMap</a> contributors'
attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
/>
{marker}
</Map>;
Expand Down
2 changes: 1 addition & 1 deletion example/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class SimpleExample extends Component {
return <Map center={position} zoom={this.state.zoom}>
<TileLayer
url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'
attribution='&copy; <a href='http://osm.org/copyright'>OpenStreetMap</a> contributors'
attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
/>
<Marker position={position}>
<Popup>
Expand Down
2 changes: 1 addition & 1 deletion example/vector-layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class VectorLayersExample extends Component {
return <Map center={center} zoom={13}>
<TileLayer
url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'
attribution='&copy; <a href='http://osm.org/copyright'>OpenStreetMap</a> contributors'
attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
/>
<Circle center={center} radius={200} fillColor='blue' />
<CircleMarker center={[51.51, -0.12]} radius={20} color='red'>
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var logTime = function(fileName) {
var time = ms < 1000
? $.util.colors.magenta(ms + ' ms')
: $.util.colors.magenta(ms / 1000 + ' s');
$.util.log('Browserified '' + name + '' in ' + time);
$.util.log('Browserified "' + name + '" in ' + time);
};
};

Expand Down
5 changes: 3 additions & 2 deletions src/MapComponent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import clone from 'lodash/lang/clone';
import forEach from 'lodash/collection/forEach';
import reduce from 'lodash/collection/reduce';
import keys from 'lodash/object/keys';
import { Component } from 'react';

const EVENTS_RE = /on(?:Leaflet)?(.+)/i;
Expand All @@ -11,10 +12,10 @@ export default class MapComponent extends Component {
}

extractLeafletEvents(props) {
return reduce(props, (res, cb, ev) => {
return reduce(keys(props), (res, ev) => {
if (EVENTS_RE.test(ev)) {
const key = ev.replace(EVENTS_RE, (match, p) => p.toLowerCase());
res[ key ] = cb;
res[ key ] = props[ev];
}
return res;
}, {});
Expand Down