PanGestureHandler w/o child Animated?
See original GitHub issueI have a use case where I need to know about drag events but don’t actually want to animate the direct child of the PanGestureHandler.
For example, the following code for a “Draggable” component does not work:
<View>
{/* Note how the Animated.View is outside PanGestureHandler */}
<Animated.View
style={[
{
transform: [
{ translateX: this._translateX },
{ translateY: this._translateY },
],
},
]}
>
{/* Clone on drag */}
{this.state.active && this.props.children}
</Animated.View>
{/* Listen for drag events */}
<PanGestureHandler
onGestureEvent={this._onGestureEvent}
onHandlerStateChange={this._onHandlerStateChange}>
{this.props.children}
</PanGestureHandler>
</View>
Is this simply not possible?
Issue Analytics
- State:
- Created 6 years ago
- Comments:19 (16 by maintainers)
Top Results From Across the Web
About Gesture Handlers | React Native ... - Software Mansion
Because handlers do not instantiate native views but instead hook up to their child views, directly nesting two gesture handlers using Animated.event is...
Read more >Pass touch events to child view using react-native-gesture ...
I am using this React-Native-Gesture-Handler for handling my gesture user do on the app. But the gesture seems to not work as expected...
Read more >How do I properly ad drag-and-drop functionality to ... - Reddit
I'm trying to drag & drop the child elements of a FlatList using react-native-gesture-handler's PanGestureHandler.
Read more >Building a Draggable Sheet with React Native Reanimated 2
This essentially affords you two screens in one. You may have seen an example when using ... The result is smooth and responsive...
Read more >Gesture with animation - Expo Snack
import React, { Component } from 'react'; import { StyleSheet, View } from 'react-native'; import { PanGestureHandler, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @scottmas sorry for late response on that.
I just tried you example app two comments from now and just made one change in it – replaced View that’s inside PanGestureHandler with Animated.View:
Panning on the red box makes the other box move now. Not sure if that’s what you’d expect to happen
Yes, thanks I think once I have time to finish new docs this information is going to be included