Material-ui: [system] Component issue displayPrint

Created on 10 Jun 2019  路  6Comments  路  Source: mui-org/material-ui

Hello,

I found an issue with the component Box.
the displayPrint attribute looks not working once you try to make it dynamic.
is there another way to make it works ??

<Box displayPrint={hidden ? 'none' : 'block'}> 
  Should hide the block in print mode once hidden is true
</Box> 

looks like only the first value given is taken into account.

Chrome: Version 74.0.3729.169 (Official Build) (64-bit)

bug 馃悰 Box system

Most helpful comment

@jdboni Thank you. I can confirm the bug. It seems to be an issue at the JSS level, it works with styled-components:

-import Box from "@material-ui/core/Box";
+import styled from 'styled-components';
+import { display } from '@material-ui/system';

+const Box = styled('div')`${display}`;

All 6 comments

@jdboni Please provide a full reproduction test case. This would help a lot 馃懛 .
A live example would be perfect. This codesandbox.io template _may_ be a good starting point. Thank you!

Hi @oliviertassinari here you can find an example:

https://codesandbox.io/s/create-react-app-bk7yk

Normally if you click on the button "Hide" and after "print" you should not see the Box.

Regards,
JD

@jdboni Thank you. I can confirm the bug. It seems to be an issue at the JSS level, it works with styled-components:

-import Box from "@material-ui/core/Box";
+import styled from 'styled-components';
+import { display } from '@material-ui/system';

+const Box = styled('div')`${display}`;

Nice! indeed I confirm that it is working with this patch!
Thanks!

I have created a related issue: https://github.com/cssinjs/jss/issues/1118.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

celiao picture celiao  路  54Comments

Bessonov picture Bessonov  路  93Comments

kybarg picture kybarg  路  164Comments

garygrubb picture garygrubb  路  57Comments

iceafish picture iceafish  路  62Comments