I am using Material UI for my react project and using the select dropdown that has been shown in the Material UI documentation. On clicking the second set of select drop down (native Select) options appears with a default blue hover effect. How can I disable the hover effect from the select element drop down menu using custom theme?
import React from 'react';[![enter image description here][1]][1]
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import { withStyles } from '@material-ui/core/styles';
import OutlinedInput from '@material-ui/core/OutlinedInput';
import InputLabel from '@material-ui/core/InputLabel';
import FormControl from '@material-ui/core/FormControl';
import Select from '@material-ui/core/Select';
const styles = theme => ({
root: {
display: 'flex',
flexWrap: 'wrap',
},
formControl: {
margin: theme.spacing.unit,
minWidth: 120,
},
selectEmpty: {
marginTop: theme.spacing.unit * 2,
},
});
class NativeSelects extends React.Component {
state = {
age: '',
labelWidth: 0,
};
componentDidMount() {
this.setState({
labelWidth: ReactDOM.findDOMNode(this.InputLabelRef).offsetWidth,
});
}
handleChange = name => event => {
this.setState({ [name]: event.target.value });
};
render() {
const { classes } = this.props;
return (
<div className={classes.root}>
<FormControl className={classes.formControl}>
<InputLabel htmlFor="age-native-simple">Age</InputLabel>
<Select
native
value={this.state.age}
onChange={this.handleChange('age')}
inputProps={{
name: 'age',
id: 'age-native-simple',
}}
>
<option value="" />
<option value={10}>Ten</option>
<option value={20}>Twenty</option>
<option value={30}>Thirty</option>
</Select>
</FormControl>
<FormControl variant="outlined" className={classes.formControl}>
<InputLabel
ref={ref => {
this.InputLabelRef = ref;
}}
htmlFor="outlined-age-native-simple"
>
Age
</InputLabel>
<Select
native
value={this.state.age}
onChange={this.handleChange('age')}
input={
<OutlinedInput
name="age"
labelWidth={this.state.labelWidth}
id="outlined-age-native-simple"
/>
}
>
<option value="" />
<option value={10}>Ten</option>
<option value={20}>Twenty</option>
<option value={30}>Thirty</option>
</Select>
</FormControl>
</div>
);
}
}
NativeSelects.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(NativeSelects);