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

feat: doubleTapGesture must depend on pinchEnabled #54

Merged
merged 3 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/src/screens/Photos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export const Photos = () => {
onIndexChange={onIndexChange}
onSwipeToClose={goBack}
onTap={onTap}
pinchEnabled={true}
baronha marked this conversation as resolved.
Show resolved Hide resolved
loop
onScaleEnd={(scale) => {
if (scale < 0.8) {
Expand Down
6 changes: 6 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ type Props<T> = EventsCallbacks & {
doubleTapScale: number;
maxScale: number;
pinchEnabled: boolean;
doubleTapEnabled: boolean;
disableTransitionOnScaledImage: boolean;
hideAdjacentImagesOnScaledImage: boolean;
disableVerticalSwipe: boolean;
Expand Down Expand Up @@ -149,6 +150,7 @@ const ResizableImage = React.memo(
doubleTapInterval,
maxScale,
pinchEnabled,
doubleTapEnabled,
disableTransitionOnScaledImage,
hideAdjacentImagesOnScaledImage,
disableVerticalSwipe,
Expand Down Expand Up @@ -782,6 +784,7 @@ const ResizableImage = React.memo(
});

const doubleTapGesture = Gesture.Tap()
.enabled(doubleTapEnabled)
.numberOfTaps(2)
.maxDelay(doubleTapInterval)
.onEnd(({ x, y, numberOfPointers }) => {
Expand Down Expand Up @@ -880,6 +883,7 @@ type GalleryProps<T> = EventsCallbacks & {
style?: ViewStyle;
containerDimensions?: { width: number; height: number };
pinchEnabled?: boolean;
doubleTapEnabled?: boolean;
disableTransitionOnScaledImage?: boolean;
hideAdjacentImagesOnScaledImage?: boolean;
disableVerticalSwipe?: boolean;
Expand All @@ -900,6 +904,7 @@ const GalleryComponent = <T extends any>(
doubleTapInterval = 500,
maxScale = MAX_SCALE,
pinchEnabled = true,
doubleTapEnabled = true,
disableTransitionOnScaledImage = false,
hideAdjacentImagesOnScaledImage = false,
onIndexChange,
Expand Down Expand Up @@ -1030,6 +1035,7 @@ const GalleryComponent = <T extends any>(
doubleTapInterval,
maxScale,
pinchEnabled,
doubleTapEnabled,
disableTransitionOnScaledImage,
hideAdjacentImagesOnScaledImage,
disableVerticalSwipe,
Expand Down