-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
createUseStyles + @media + Adapting based on props: not updating correctly #1327
Comments
I want to add, that having multiple instances of a component with different props affecting media queries also seems broken. Here is a little encanced version of the codesandbox example above: |
I think this + #1320 + #1343 can all be closed. I think the syntax has changed in the newest version so media queries work for all these cases. https://codesandbox.io/s/admiring-rosalind-ureou?file=/src/App.js |
@RobertAron I just tried this case and it doesn't work
when the window is min width of 1024 I expect it to be red but it's green. |
@j4mesjung we need to document this, but function rules/values have higher source order specificity, because rendered after static rules |
@kof makes sense but how would we structure the css so that the media takes precedence over the function values? |
Either by also using a function value or by placing it in a separate style sheet that is rendered after. |
You can also cheat the specificity by doing this const useStyles = createUseStyles({
test: {
backgroundColor: (prop) => prop.c
},
"@media (min-width: 1024px)": {
test: {
'&&':{
backgroundColor: "red"
}
}
}
}) The only reason I know that was from looking at other issues to work on and saw this: #1045 |
Expected behavior:
When a property is changed, styles that are inside a @media selector are not being re-generated.
Describe the bug:
When a property is changed, all styles that are properties-dependent should be re-generated and re-applied to the component.
Steps:
Codesandbox link:
https://codesandbox.io/s/createusestyles-media-vf5zs
Versions (please complete the following information):
Feel free to add any additional versions which you may think are relevant to the bug.
The text was updated successfully, but these errors were encountered: