Skip to content

Commit

Permalink
fix(select): prop value should be string only (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgr34 authored and Matt Goo committed Mar 18, 2019
1 parent af449f4 commit 619d12c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/select/NativeControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface NativeControlProps extends React.HTMLProps<HTMLSelectElement> {
foundation: MDCSelectFoundation;
setRippleCenter: (lineRippleCenter: number) => void;
handleDisabled: (disabled: boolean) => void;
value: string;
}

export default class NativeControl extends React.Component<
Expand All @@ -49,6 +50,7 @@ export default class NativeControl extends React.Component<
},
setRippleCenter: () => {},
handleDisabled: () => {},
value: '',
};


Expand Down
2 changes: 2 additions & 0 deletions packages/select/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class MyApp extends React.Component {
<Select
label='Choose Dog'
onChange={(evt) => this.setState({value: evt.target.value})}
value={this.state.value}
options={options}
/>
);
Expand Down Expand Up @@ -103,6 +104,7 @@ nativeControlClassName | String | An optional class added to the native `<select
notchedOutlineClassName | String | An optional class added to the notched outline element. Only applied if `props.outlined` is enabled.
outlined | Boolean | Enables outlined variant.
options | Array{String/Object} | Array of strings or objects to be used as options. To be used instead of `<option>` elements passed as `this.props.children`. If its an array of strings, then the string value will be used as the `label` and `value` of the `<option>` tag.
value | String | Optional property used to control the selected value outside of `<Select>` component.

### Sass Mixins

Expand Down
3 changes: 2 additions & 1 deletion packages/select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ export interface SelectProps extends React.HTMLProps<HTMLSelectElement> {
notchedOutlineClassName: string;
outlined: boolean;
options: SelectOptionsType;
value?: string;
}

interface SelectState {
value?: string | string[] | number,
value?: string;
classList: Set<string>;
disabled: boolean;
labelIsFloated: boolean;
Expand Down

0 comments on commit 619d12c

Please sign in to comment.