added name to select component and fixed wrong type for value

This commit is contained in:
Sebastian Sdorra
2018-11-06 16:37:39 +01:00
parent d230511ad8
commit c14e8d654b

View File

@@ -9,10 +9,11 @@ export type SelectItem = {
}; };
type Props = { type Props = {
name?: string,
label?: string, label?: string,
options: SelectItem[], options: SelectItem[],
value?: SelectItem, value?: string,
onChange: string => void, onChange: (value: string, name?: string) => void,
loading?: boolean, loading?: boolean,
helpText?: string helpText?: string
}; };
@@ -29,7 +30,7 @@ class Select extends React.Component<Props> {
} }
handleInput = (event: SyntheticInputEvent<HTMLSelectElement>) => { handleInput = (event: SyntheticInputEvent<HTMLSelectElement>) => {
this.props.onChange(event.target.value); this.props.onChange(event.target.value, this.props.name);
}; };
render() { render() {