We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I noticed that the typescript type for the on change event of a select TextField does not match the actual event object returned.
Typescript type matches the actual object in an TextField onchange event.
Event object passed into an onChange event handler from a TextField is different between a default text field and a choice TextField.
<TextField label="With normal TextField" id="simple-start-adornment" className={classNames(classes.margin, classes.textField)} onChange={this.handleTextFieldOnChange('justText')} /> <TextField select label="With Select" className={classNames(classes.margin, classes.textField)} value={this.state.weightRange} onChange={this.handleTextFieldOnChange('choices')} > {ranges.map(option => ( <MenuItem key={option.value} value={option.value}> {option.label} </MenuItem> ))} </TextField> handleTextFieldOnChange = (prop: string) => (event: React.ChangeEvent<HTMLInputElement>) => { console.log(event); this.setState({ [prop]: event.target.value }); }
The text was updated successfully, but these errors were encountered:
I think this issue is legit. I reckon a fix can just be simply as updating [TextField] onChange type defintion to be:
onChange
onChange?: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>;
Sorry, something went wrong.
No branches or pull requests
I noticed that the typescript type for the on change event of a select TextField does not match the actual event object returned.
Expected Behavior
Typescript type matches the actual object in an TextField onchange event.
Current Behavior
Event object passed into an onChange event handler from a TextField is different between a default text field and a choice TextField.
Steps to Reproduce
Your Environment
The text was updated successfully, but these errors were encountered: