Fixed select onchange not working

This commit is contained in:
Alexander Skvortsov 2020-04-29 19:30:00 -04:00 committed by David Sevilla Martín
parent b952f6a2bc
commit b7af59fe43

View File

@ -5,7 +5,7 @@ export interface SelectProps extends ComponentProps {
/** /**
* Disabled state for the input. * Disabled state for the input.
*/ */
disabled: boolean; disabled?: boolean;
/** /**
* A callback to run when the selected value is changed. * A callback to run when the selected value is changed.
@ -29,7 +29,7 @@ export interface SelectProps extends ComponentProps {
* The `Select` component displays a <select> input, surrounded with some extra * The `Select` component displays a <select> input, surrounded with some extra
* elements for styling. * elements for styling.
*/ */
export default class Select<T extends SelectProps = SelectProps> extends Component<SelectProps> { export default class Select<T extends SelectProps = SelectProps> extends Component<T> {
view() { view() {
return ( return (
<span className="Select"> <span className="Select">
@ -51,7 +51,7 @@ export default class Select<T extends SelectProps = SelectProps> extends Compone
/** /**
* Run a callback when the state of the checkbox is changed. * Run a callback when the state of the checkbox is changed.
*/ */
protected onchange() { protected onchange(value) {
if (this.props.onchange) this.props.onchange(this); if (this.props.onchange) this.props.onchange(value);
} }
} }