Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

fix(select): prop value should be string only #725

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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