Skip to content

Only extract leaflet events for prop keys when callback exists#308

Merged
PaulLeCam merged 1 commit intoPaulLeCam:masterfrom
awinograd:patch-1
Apr 5, 2017
Merged

Only extract leaflet events for prop keys when callback exists#308
PaulLeCam merged 1 commit intoPaulLeCam:masterfrom
awinograd:patch-1

Conversation

@awinograd
Copy link
Contributor

Fixes the following when myCondition is falsey.

<MapComponent onClick={myCondition ? myCallback : null} />

Fixes the following: <MapComponent onClick={null} />
if (EVENTS_RE.test(prop)) {
const key = prop.replace(EVENTS_RE, (match, p) => p.toLowerCase())
res[ key ] = props[ prop ]
if (props[ prop ]) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another option would be to do:

if (typeof props[ prop ] === 'function') 

@awinograd
Copy link
Contributor Author

The CI seems to be failing for non PR related reasons

@PaulLeCam PaulLeCam merged commit 33b0bb1 into PaulLeCam:master Apr 5, 2017
@PaulLeCam
Copy link
Owner

Good idea, thanks!

@awinograd
Copy link
Contributor Author

Thanks @PaulLeCam! Hope it's helpful to others as well

@PaulLeCam
Copy link
Owner

Yes, it's always a nice feature to have!
It's now published in v1.1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants