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

Feature Request: onSwipeDown handler? #64

Closed
IroncladDev opened this issue Sep 6, 2024 · 4 comments
Closed

Feature Request: onSwipeDown handler? #64

IroncladDev opened this issue Sep 6, 2024 · 4 comments
Labels

Comments

@IroncladDev
Copy link

This package saved my life. Huge thanks to the creator and all the contributors.

Is your feature request related to a problem? Please describe.
The feature request isn't related to a necessary problem. It would be nice to have for better UX.

Describe the solution you'd like
I want an onSwipeDown handler/callback I can pass to the component. A common use case of this feature is to close a dialog/modal with an image you're inspecting.

Describe alternatives you've considered
I'm not super familiar with React Native just yet, so I'm not aware of any alternate solutions to cover this use case with

Additional context
N/A

@artem-bq
Copy link

I'm also interested in this. The absence of this feature is what makes me look for an alternative package. Perhaps there is some approach (I need to implement closing the modal by swiping down)

@keuvy
Copy link

keuvy commented Oct 17, 2024

It is a feature that I would like too.

I achieved it this way, I hope it works for you:

import { ImageZoom } from '@likashefqet/react-native-image-zoom';
import { Animated } from 'react-native';
import { Directions, Gesture, GestureDetector } from 'react-native-gesture-handler';
import { runOnJS } from 'react-native-reanimated';

const [closable, setClosable] = useState(true);

const fling = Gesture.Fling()
    .direction(Directions.DOWN | Directions.UP)
    .onEnd((evt) => {
        if (closable) {
            runOnJS(router.back())();
        }
    });

return (
    <GestureDetector gesture={fling}>
        <Animated.View>
            <ImageZoom
                    uri={url}
                    isDoubleTapEnabled
                    doubleTapScale={3}
                    onPinchStart={() => {
                        if (setClosable) setClosable(false);
                    }}
                    onDoubleTap={(zoomType) => {
                        if (setClosable) setClosable(false);
                    }}
                    onResetAnimationEnd={(finished, values) => {
                        if (finished) {
                            setClosable(true);
                        }
                    }}
                />
        </Animated.View>
    </GestureDetector>
)

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.

@github-actions github-actions bot added the Stale label Dec 16, 2024
Copy link

github-actions bot commented Jan 1, 2025

This issue was closed because it has been stalled for 15 days with no activity.

@github-actions github-actions bot closed this as completed Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants