-
-
Notifications
You must be signed in to change notification settings - Fork 903
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
Flashing on resize #1705
Comments
Duplicate of #418 |
Hey there, Thanks for putting this project together, I'm using it to display a resume pdf on my portfolio site. I'm having this problem as well where the container loses height on resize. It's a behaviour that exists in the Screen.Recording.2024-04-04.at.1.58.54.PM.mp4In my usecase all the pages are rendered in sequence just like in the I tried to implement the solution from #418 but couldn't get it figured out. Steps to reproduce
|
doing something like this fixed the problem here const onResize = useCallback<ResizeObserverCallback>((entries) => {
const [entry] = entries
if (entry) {
setContainerWidth((p = 1) => {
const newWidth = entry.contentRect.width
return Math.abs(p - newWidth) > 50 ? newWidth : p
})
}
}, []) |
Before you start - checklist
Description
I am trying to make my PDF responsive, however, I continually run into the same issue where the PDF pages disappear and reappear during the render phase. This causes my container to lose height and thus resets the scroll, which is a 2nd order problem caused by this behavior. In the other threads I've seen about responsive width, I haven't seen anyone document this issue.. Is there any solution? I have already implemented the suggested fix for scaling (having two pages render depending on if the scale has changed or not). I was wondering if there was some similar work around for sizing, as I have not been able to figure it out.
Kapture.2024-01-29.at.22.48.11.mp4
Steps to reproduce
This is roughly what my code looks like:
Expected behavior
I expect the PDF to not flash when resizing it's parent container.
Actual behavior
The PDF disappears and reappears.
Additional information
No response
Environment
The text was updated successfully, but these errors were encountered: