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

Conflict with PanGestureHandler #195

Open
Hristijan95 opened this issue Jun 18, 2020 · 1 comment
Open

Conflict with PanGestureHandler #195

Hristijan95 opened this issue Jun 18, 2020 · 1 comment
Labels
bug report Something isn't working

Comments

@Hristijan95
Copy link

Environment

System:
OS: macOS 10.15.5
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 249.04 MB / 8.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.4.0 - /usr/local/bin/node
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
API Levels: 23, 28, 29
Build Tools: 28.0.3, 29.0.3
System Images: android-30 | Google Play Intel x86 Atom
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6514223
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5

Description

When I wrap the into a it conflicts somehow and it doesn't slide. You can change the value by clicking on the slider line, but you can slide it because the PanGestureHandler steals the drag event. I am not sure if this is a bug, or just a solvable case, but I was not able to solve it.

Reproducible Demo

To reproduce it it's pretty simple, here's the code structure:

<PanGestureHandler onGestureEvent={onPanGestureEvent} onHandlerStateChange={onPanStateChange}> <Animated.View> <Slider/> </Animated.View> </PanGestureHandler>

@Hristijan95 Hristijan95 added the bug report Something isn't working label Jun 18, 2020
@jamesehly
Copy link

I had a similar issue with the slider inside of a DraggableFlatlist item (https://github.com/computerjazz/react-native-draggable-flatlist). I set the activationDistance to 10 and that fixed the issue. DraggableFlatlist uses the PanGestureHandler and sets the activateOffsetX or activateOffsetY to the activationDistance, so you might try setting those values to something greater than zero to get the slider to activate before the PanGestureHandler does.

Here is an example that works for me:

<PanGestureHandler onGestureEvent={onPanGestureEvent} activeOffsetX={30}>
     <Animated.View>
        <Slider />
    </Animated.View>
</PanGestureHandler>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Something isn't working
Projects
Status: To be analyzed
Development

No branches or pull requests

2 participants