I made a custom theme in Material-UI, overriding the defaultProps for the Textfield Component:
const customTheme = createTheme({
components: {
MuiTextField: {
defaultProps: {
InputProps: {
notched: false,
},
},
}
}
When I try to use the component in my project, it works as expected, with the default prop being set to notched:false:
<TextField label="Enter Something" />
However, when I try to mention some other prop on the InputProps prop, it overrides the notched prop, to the factory default:
<TextField label="Enter Something" InputProps={{ readOnly:true }} /> // component behaves like I never set the defaultProps on the customTheme
How can I prevent it from overriding my custom theme, unless i explicitly set that prop on the component instance?
<TextField label="Enter Something" InputProps={{ readOnly:true, notched:true }} />