mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.64k stars 32.22k forks source link

jss-rtl not working with makeStyles when property is calculated with arrow function #18477

Closed sashberd closed 4 years ago

sashberd commented 4 years ago

Hi

We use jss-rtl plugin in our app. After update to latest 4.6.1 version we found that if we use makeStyles approach and use arrow function on property that jss-rtlshould manage it is not working, but if we change it to simple string it works as it should be:

This is not working:

const useStyles = makeStyles(({ axisPalette }) => ({
buttonIconRoot: {
    paddingRight: ({ isMobile }) => (isMobile ? 0 : '6px'),
}
}))

This one is working properly:

const useStyles = makeStyles(({ axisPalette }) => ({
buttonIconRoot: {
    paddingRight: '6px',
}
}))
oliviertassinari commented 4 years ago

@sashberd This is likely an issue with JSS. I would encourage you to create a reproduction with react-jss directly.

sashberd commented 4 years ago

@oliviertassinari Opened in react jss issues

sashberd commented 4 years ago

@oliviertassinari this approach is working for me:

 buttonIconRoot: ({isMobile})=>({
    paddingRight: isMobile ? 0 : '6px',
})
oliviertassinari commented 4 years ago

I'm closing for https://github.com/cssinjs/jss/issues/1234