import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import Icon from 'stremio-icons/dom'; import styles from './styles'; class Checkbox extends Component { shouldComponentUpdate(nextProps) { return nextProps.checked !== this.props.checked || nextProps.disabled !== this.props.disabled || nextProps.className !== this.props.className; } onClick = (event) => { event.preventDefault(); if (typeof this.props.onClick === 'function') { this.props.onClick(event); } } render() { return (
); } } Checkbox.propTypes = { className: PropTypes.string, disabled: PropTypes.bool.isRequired, checked: PropTypes.bool.isRequired, onClick: PropTypes.func }; Checkbox.defaultProps = { disabled: false, checked: false }; const CheckboxWithForwardedRef = React.forwardRef((props, ref) => ( )); CheckboxWithForwardedRef.displayName = 'CheckboxWithForwardedRef'; export default CheckboxWithForwardedRef;