luqin / react-icheck

:radio_button: iCheck components built with React. Highly customizable checkbox, radio buttons and radio group.
https://luqin.github.io/react-icheck
177 stars 40 forks source link

Added stopPropagation and preventDefault to onChange #11

Closed alex-e-leon closed 8 years ago

alex-e-leon commented 8 years ago

This fixes a bug when you wrap react-icheck in a label, as it currently will trigger the onChange event twice (once when you click the checkbox, once when the event bubbles up to the label).

This is inline with ichecks implementation see https://github.com/fronteed/icheck/blob/1.x/icheck.js#L218

Note, that I'd prefer to not stop the event bubble chain, but due to ichecks implementation, I'm not sure there's any other way to fix this bug.