Closed flo-pereira closed 5 years ago
Hey,
According to the docs, you need to use createEmotion or createCache and assign a container for emotion to render your styles into.
thanks @diffidentDude, it does the trick !! 👍
it worked for me too. working example:
`export default function Portfolio() {
const muiRef = useRef(null);
// Declare a new state variable, which we'll call "count"
const [refCurr, setRefCurr] = useState(null);
useEffect(() => {
setRefCurr(muiRef.current);
}, []);
return (
<div ref={muiRef} style={{height: '650px'}}>
<CacheProvider value={createCache({
key: 'aaa',
prepend: true,
container: refCurr,
})}>
<Box sx={{ width: '100%' }} >
<DataGridPro
autoHeight
treeData
rows={rows}
columns={columns}
getTreeDataPath={getTreeDataPath}
rowThreshold={0}
getDetailPanelContent={getDetailPanelContent}
getDetailPanelHeight={getDetailPanelHeight}
hideFooter
/>
</Box>
</CacheProvider>
</div>
);
} `
Hi, better than explain, let me show you.
What's happening:
What I expected:
Environment information:
"@emotion/core": "^10.0.10", "@emotion/styled": "^10.0.11", "react": "^16.8.6", "react-dom": "^16.8.6",
How can I use emotion/styled inside Webcomponents shadow dom.