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

V4.0 Add Zoomable Component #58

Merged
merged 2 commits into from
Aug 4, 2024
Merged

V4.0 Add Zoomable Component #58

merged 2 commits into from
Aug 4, 2024

Conversation

likashefqet
Copy link
Owner

What's new

  • Zoomable Component: This component makes any child elements zoomable, ensuring they behave like the image zoom component. This is particularly useful when you need to replace the default image component with alternatives like Expo Image (see example) or Fast Image.

  • Updated Ref Handle: Customize the functionality further by utilizing the exposed zoom method. This method allows you to programmatically zoom in the image to a given point (x, y) at a given scale level.

Zoomable with Expo Image Example

<Zoomable
  ref={ref}
  minScale={0.5}
  maxScale={5}
  doubleTapScale={3}
  minPanPointers={1}
  isSingleTapEnabled
  isDoubleTapEnabled
  onInteractionStart={() => {
    console.log('onInteractionStart');
    onZoom();
  }}
  onInteractionEnd={() => console.log('onInteractionEnd')}
  onPanStart={() => console.log('onPanStart')}
  onPanEnd={() => console.log('onPanEnd')}
  onPinchStart={() => console.log('onPinchStart')}
  onPinchEnd={() => console.log('onPinchEnd')}
  onSingleTap={() => console.log('onSingleTap')}
  onDoubleTap={(zoomType) => {
    console.log('onDoubleTap', zoomType);
    onZoom(zoomType);
  }}
  onProgrammaticZoom={(zoomType) => {
    console.log('onZoom', zoomType);
    onZoom(zoomType);
  }}
  style={styles.image}
  onResetAnimationEnd={(finished) => {
    console.log('onResetAnimationEnd', finished);
    onAnimationEnd(finished);
  }}
>
  <Image style={styles.image} source={{ uri }} contentFit="cover" />
</Zoomable>

@likashefqet likashefqet self-assigned this Aug 4, 2024
@likashefqet likashefqet added the enhancement New feature or request label Aug 4, 2024
@likashefqet likashefqet merged commit cf6ff72 into main Aug 4, 2024
5 of 6 checks passed
@likashefqet likashefqet deleted the v4.0 branch August 25, 2024 20:56
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

Successfully merging this pull request may close these issues.

1 participant