问题
I am making a custom textinput with different focus and normal colors, for this i am using withStyles function and i am overriding the control colors. below is the code
const CustomTextInput = withStyles({
root: {
'& label.Mui-focused': {
color: "gray",
},
'& .MuiInput-underline:after': {
borderBottomColor: "#00ff00",
},
'& .MuiInput-underline:before': {
borderBottomColor: 'gray',
},
},
})(TextField);
export default function CustomTextInput(props) {
-----
}
But in above i have hard coded the colors for focus and normal which i want to fill via props. So is the anyway to pass props to withStyles function? Is there anyway to assign props to global constant?
来源:https://stackoverflow.com/questions/63052170/how-can-we-send-props-to-withstyles-react-js-meterial-textfield