-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Using Controlled zoom & ZoomContent at the same time breaks #448
Comments
That sounds rough. Thanks for the report! I'll see what I can do. |
This is the next issue I'm doing! Time-expectation-wise, I'll be able to look at it within the next week. Thank you for your patience. |
Okay... initial finding: Converting this ZoomContent={(props) => <CustomZoomContent {...props} />} to this ZoomContent={CustomZoomContent} works with the However, the |
I also was able to get it working using const Zoom2Content = useCallback(
(props: ControlledProps) => <CustomZoomContent {...props} />,
[]
); You can see that working on this CodeSandbox |
I think that the issue is that When we use However, with the There are some workarounds I've listed above, and this seems like a bit of a deep dive to figure out any further that I don't have time for tonight, unfortunately. G'night! |
@rpearce The solution/workaround above with |
And separately, I had to get the internal props of const enum ModalState {
LOADED = "LOADED",
LOADING = "LOADING",
UNLOADED = "UNLOADED",
UNLOADING = "UNLOADING",
}
type ZoomContentProps = {
img: React.ReactElement | null;
buttonUnzoom: React.ReactElement<HTMLButtonElement>;
modalState: ModalState;
onUnzoom: () => void;
};
const ZoomContent = useCallback(
(props: ZoomContentProps) => <CustomZoomContent {...props} />,
[],
); Exposing these type definitions from the package to the user to make this a bit easier (and less copy-paste-y) would perhaps be a good idea as well. |
I need to fix the core issue, and if there are more types that need exporting, I'll see to that. Thanks for your notes. |
@rpearce Any news on that |
@ScreamZ The issue will be closed and commented on with the fix version when it's resolved. |
Issue Type
Description
See repro in Codesandbox link: https://codesandbox.io/s/snowy-hill-ltjwwc?file=/src/App.tsx
Using
Controlled
withZoomContent
prop breaks the webpage that it's used in. Using them separately works fine.After the first zoom-in, the first zoom-out breaks (no animation), and every interaction on the website thereafter is locked.
The text was updated successfully, but these errors were encountered: