Strange customisation warning
See original GitHub issueProblem description
I have built a customisation of one of the Material UI component successfully. However at runtime, I’m getting a strange warning.
Steps to reproduce
import * as React from "react";
import { TextField } from "material-ui";
import { withStyles } from "material-ui/styles";
import { Theme } from "material-ui/styles/theme";
import { Styles, StylingProps } from ".";
type Classes = "inkbar" | "underline";
const styles = (theme: Theme): Styles<Classes> => ({
inkbar: {
"&:after": {
backgroundColor: theme.palette.primary[500]
}
},
underline: {
"&:hover:not($disabled):before": {
height: "1px !important"
}
}
});
interface TextInputProps {
placeholder: string;
}
class TextInput extends React.Component<StylingProps<Classes> & TextInputProps> {
render() {
const {classes} = this.props;
const {placeholder} = this.props;
return <TextField fullWidth={true} {...{ placeholder }} InputProps={{ classes } as {}} />;
}
}
export default withStyles<TextInputProps>(styles)(TextInput);
The customization works as expected but I’m running, the following warning is thrown:
Warning: Material-UI: the key `.TextInput-inkbar-11:after` provided to the classes property object is not implemented in Input.
You can only overrides one of the following: root,formControl,inkbar...
am I doing something wrong?
Versions
- Material-UI: v1-beta6
Issue Analytics
- State:
- Created 6 years ago
- Comments:23 (19 by maintainers)
Top Results From Across the Web
Strange customisation warning #8048 - mui/material-ui - GitHub
I have built a customisation of one of the Material UI component successfully. However at runtime, I'm getting a strange warning.
Read more >How to Get Out of "Warning A Custom OS can ... - YouTube
If you are stuck in the blue screen that says, " Warning A Custom OS can cause critical problems in phone and installed...
Read more >Doctor Strange Warnings After Spells Meme Generator - Imgflip
Insanely fast, mobile-friendly meme generator. Make Doctor Strange Warnings After Spells memes or upload your own images to make custom memes.
Read more >Its been almost one week, here are the best Twitter reactions ...
'Doctor Strange in the Multiverse of Madness' has already made over 450 million ... (final spoiler warning) is, drum roll, the evil villain...
Read more >Change the alert sounds on Mac - Apple Support
On your Mac, change the alert sounds and other sound effects using Sound settings.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@oliviertassinari Thanks for reply. OK, Let me ask another question. Link: https://material-ui.com/components/switches/ Row : Customize switches Code: const PurpleSwitch = withStyles({ switchBase: { color: purple[300], ‘&$checked’: { color: purple[500], }, ‘&$checked + $track’: { backgroundColor: purple[500], }, }, checked: {}, track: {}, })(Switch); This is the code shared , and I did try this. It throws and error if you leave track{} in and throws and error without. I also cannot read anywhere how to change the bar using this style ? Can you advise ?
ERROR WITH: index.js:1437 Warning: Material-UI: the key
track
provided to the classes property is not implemented in Switch. You can only override one of the following: root,icon,iconChecked,switchBase,checked,colorPrimary,colorSecondary,disabled,barERROR WITHOUT: Warning: [JSS] Could not find the referenced rule track in WithStyles(Switch).
I have the remove the entire track business to remove error
Also i tried changing the bar many ways at no success. I can change it before its checked, onlyu issue is after its checked ?
Daniel
@oliviertassinari Thank you so much for giving the lead on this. The
classes
struct looked like this:So I had to filter the
.TextInput-inkbar-11:after
and.TextInput-underline-12:hover:not(disabled):before
properties to get rid of the warning. Is this a bug?I’m also getting the following warning:
Probably because I don’t use these rules in TextInput but only to pass them into the subcomponent? Is there a way I could get rid of this warning as well?