Skip to content
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

[Gallery] onZoomBegin callback? #37

Closed
cw-nikhilnaik opened this issue Jul 19, 2024 · 3 comments
Closed

[Gallery] onZoomBegin callback? #37

cw-nikhilnaik opened this issue Jul 19, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@cw-nikhilnaik
Copy link

cw-nikhilnaik commented Jul 19, 2024

Hello,

It would be really helpful if we can have onZoomBegin and onZoomEnd callback so that we can add animations to other components.

Currently we can only requestState and fetch scale value but thats a ref, so cant detect it

Also there is onPinchStart and no onDoubleTap which again doesnt serve my need

My need: I want to detect when the image has been zoomed and when it is in initial state automatically

@Glazzes
Copy link
Owner

Glazzes commented Jul 19, 2024

I'm sorry but you'll have to ellaborate your statements better, the only thing I got was that you need onDoubleTap callback.

It would be really helpful if we can have onZoomBegin and onZoomEnd callback so that we can add animations to other components.

Any example of such animations? What are the expected contents of onZoomBeing and onZoomEnd arguments?

Currently we can only requestState and fetch scale value but thats a ref, so cant detect it

What do you mean by "can't detect it"? What's wrong with the ref?

@cw-nikhilnaik
Copy link
Author

Hi, thankyou for the reply

So I have a screen where i render the gallery. I have also few touchable buttons with position "absolute" just below the image with zIndex:1 so that I can click on the button, but if I zoom the image, the button stays on top of image since zIndex:1, so I want the zIndex:0 when image is zoomed. Hence I needed onZoomBegin callback to know when the image started getting zoomed, and onZoomEnd callback to know when the image is back to original state.

With ref, it doesnt trigger an update, so can't use a useEffect to know the state.

I have a temporary solution implemented to workaround over it

useEffect(() => { setTimeout(()=>{ isZoomed = ref.current?.requestState().scale > 1 },100) },[])

But this is temporary fix

@Glazzes Glazzes added the enhancement New feature or request label Jul 19, 2024
@Glazzes
Copy link
Owner

Glazzes commented Aug 1, 2024

Callbacks added on pr #38

@Glazzes Glazzes closed this as completed Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants