How can we send props to “withStyles” react js meterial textfield

和自甴很熟 提交于 2021-02-11 15:13:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!