Skip to content

TapGestureHandler wrapping multiple TapGestureHandlers #1651

Answered by jgonet
ylkhayat asked this question in Q&A
Discussion options

You must be logged in to vote

Gesture handlers need a component to wrap onto (and should have only one child). Try doing something like this:

<TapGestureHandler waitFor={[controller1Ref, controller2Ref]}>
	<View>
  		<TapGestureHandler ref={controller1Ref}>
		    <Text style={{ backgroundColor: 'blue', padding: 20 }}>
		      Controller 1
    		</Text>
		</TapGestureHandler>
  		<TapGestureHandler ref={controller2Ref}>
	        <Text style={{ backgroundColor: 'blue', padding: 20 }}>
	          Controller 2
	        </Text>
  		</TapGestureHandler>
	</View>
</TapGestureHandler>

(use Animated.View instead if you're using Animated or Reanimated)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ylkhayat
Comment options

@jgonet
Comment options

Answer selected by ylkhayat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants