Skip to content

How to pass the current zoom level value to custom control component as a prop? #215

Closed Locked Answered by igordanchenko
dineshkumarrajaguru asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there!

Thank you for bringing up this use case. In retrospect, I should have probably exposed the useZoom hook 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:

  • track the zoom value with the on.zoom callback
  • pass zoom and zoomRef as props to your custom control
  • track the index value with the on.view callback 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!

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dineshkumarrajaguru
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants