You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for the very handy hook. I have a container-dependent useEffect where I do some calculations based on the transform and the dimensions of the interactive container.
const {
transform,
panZoomHandlers,
setContainer,
setPan,
setZoom,
pan,
zoom,
container
} = usePanZoom();
useEffect(() => {
// Do other stuff based on container dimensions & pan/zoom
// This useEffect won't fire until the user pans/zooms.
console.log(container ? "Container is valid" : "container is not set");
}, [pan, zoom, container]);
I worked around it by setting zoom to 1 upon initial render:
Thank you for the very handy hook. I have a container-dependent useEffect where I do some calculations based on the transform and the dimensions of the interactive container.
I worked around it by setting zoom to 1 upon initial render:
See the codesandbox fork for the full example.
https://codesandbox.io/s/use-pan-zoom-example-forked-eg4el?file=/src/app.tsx
I wouldn't necessarily call this a bug, but I would appreciate a pointer in the right direction if there is a better workaround.
The text was updated successfully, but these errors were encountered: