Closed ksgy closed 6 years ago
Hey @ksgy thanks for the contribution! I'm not exactly sure how this change helps make sure translateZ
is enabled, could you provide some more details about the problem you were seeing?
Hey @vcarl, Sure!
When a <Container>
loads and hw acceleration is disabled the default style for the element doesn't contain the translateZ
. But when user starts scrolling or resizing, the handler is called, checks if hw accel enabled. If enabled, applies translateZ
on the <Sticky>
element:
https://github.com/captivationsoftware/react-sticky/blob/master/src/Sticky.js#L99
If the <Sticky>
element has a position: fixed
element inside, could be a rendering issue until the user starts scrolling or resizes the browser. Applying the translateZ
style when the <Container>
loads can avoid these rendering issues. I think it should be there anyway by default (if hw acceleration is enabled) to avoid different styles between the "loaded state" and state after a window
event.
So the first render pass doesn't include translateZ
, and that can cause rendering errors? Could you make a demo of the problem in CodeSandbox? I'm wary of fixing problems without seeing it in action.
Closing this, but happy to reopen if you can put together a demo!
Add
onLoad
function to container to make suretranslateZ
is applied when the component loads, otherwise can cause rendering issues if hardware acceleration is enabled.