How to pass the current zoom level value to custom control component as a prop? #215
-
|
Hi Team, I have created a custom control component with Zoom in and Zoom out button and by means of zoomRef I am invoking zoom in and zoom out methods, but I need to disable Zoom out button if the user has reached the zoom level 1. I have tried the following options:
Note: @igordanchenko could you please guide me with this case? I have created a simple component to illustrate the issue, please check here |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Hi there! Thank you for bringing up this use case. In retrospect, I should have probably exposed the
https://codesandbox.io/p/devbox/yet-another-react-lightbox-215-33hyhz?file=%2Fsrc%2FApp.tsx I hope this helps! |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for the solution, @igordanchenko . It greatly aided in addressing all the use cases for my implementation. |
Beta Was this translation helpful? Give feedback.
Hi there!
Thank you for bringing up this use case. In retrospect, I should have probably exposed the
useZoomhook in the Zoom plugin to make such a case more straightforward. However, here is how you can build the desired functionality with the existing features:zoomvalue with theon.zoomcallbackzoomandzoomRefas props to your custom controlindexvalue with theon.viewcallback if your slides reset to the initial slide (see Tracking Slide Index)https://codesandbox.io/p/devbox/yet-another-react-lightbox-215-33hyhz?file=%2Fsrc%2FApp.tsx
I hope this helps!