document.removeEventListener('touchend', this.handleDocumentClick, withPassive);
}
- handleClick = (e) => {
- const name = e.currentTarget.getAttribute('data-index');
-
+ handleClick = (name, e) => {
const {
onChange,
onClose,
}
}
- handleKeyDown = e => {
+ handleKeyDown = (name, e) => {
const { items } = this.props;
- const name = e.currentTarget.getAttribute('data-index');
const index = items.findIndex(item => {
return (item.name === name);
});
let prefix = null;
if (on !== null && typeof on !== 'undefined') {
- prefix = <Toggle checked={on} onChange={this.handleClick} />;
+ prefix = <Toggle checked={on} onChange={this.handleClick.bind(this, name)} />;
} else if (icon) {
prefix = <Icon className='icon' fixedWidth id={icon} />
}
return (
<div
className={computedClass}
- onClick={this.handleClick}
- onKeyDown={this.handleKeyDown}
+ onClick={this.handleClick.bind(this, name)}
+ onKeyDown={this.handleKeyDown.bind(this, name)}
role='option'
tabIndex='0'
key={name}