Skip to content

Commit

Permalink
feat(Select): add passed props to control search value
Browse files Browse the repository at this point in the history
  • Loading branch information
ej9x committed Jun 11, 2019
1 parent 21a9af0 commit 620f7a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/Select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { type Theme, COLORS, Z_INDEX } from '../../theme';
type SelectProps = {|
options: Array<{ label: mixed, value: string }>,
onChange: (value: mixed, event?: SyntheticInputEvent<HTMLInputElement>) => void,
inputValue?: string,
onInputChange ?: (value: string, event?: SyntheticInputEvent<HTMLInputElement>) => void,
placeholder?: string,
value?: any | any[],
loading?: boolean,
Expand Down Expand Up @@ -126,6 +128,8 @@ class Select extends React.Component<SelectProps & SelectPropsFromHOCs> {
withPortal,
theme,
formatOptionLabel,
inputValue,
onInputChange,
...rest
} = this.props;

Expand All @@ -152,6 +156,8 @@ class Select extends React.Component<SelectProps & SelectPropsFromHOCs> {
value={ selectValue }
components={ components }
formatOptionLabel={ formatOptionLabel }
inputValue={ inputValue }
onInputChange={ onInputChange }
/>
</SelectTag>
);
Expand Down
4 changes: 4 additions & 0 deletions src/components/SelectField/SelectField.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ type SelectFieldProps = {
meta?: MetaType,
/** custom value component */
valueComponent ?: React$Node,
/** controlled search value */
inputValue?: string,
/** callback to control search value */
onInputChange?: (value: string, event?: SyntheticInputEvent<HTMLInputElement>) => void,
};

class SelectField extends React.Component<SelectFieldProps> {
Expand Down

0 comments on commit 620f7a4

Please sign in to comment.