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

fix: allow ZoomableView ref to be utilised via ZoomableViewWithGestures #95

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

mrbrentkelly
Copy link

@mrbrentkelly mrbrentkelly commented Mar 27, 2024

Fixes #94.

Updates the ReactNativeZoomableViewWithGestures component to manage the ref of the inner ReactNativeZoomableView component.

This allows users of ReactNativeZoomableViewWithGestures to still imperatively call the zoomTo, zoomBy, moveBy, moveTo functions of the underlying ReactNativeZoomableView.

Example:

const ref = useRef<ReactNativeZoomableViewWithGestures>(null);

return <>
  <ReactNativeZoomableViewWithGestures {ref} ... />
  <Button text="Zoom" onPress={() => {
    ref.current?.zoomableViewRef?.current?.zoomBy(2);
  }} />  
</>

Copy link
Collaborator

@elliottkember elliottkember left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one – thank you!

@elliottkember elliottkember merged commit 51e0b4b into openspacelabs:master Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReactNativeZoomableViewWithGestures does not support .zoomTo() and .moveBy() methods
2 participants