Simultaneous is not simultaneous
See original GitHub issueDescription
I am trying to reproduce a pinch and pan gesture on image like Instagram. In fact, each gesture works but not together, even with the Gesture.Simultaneous
Screenshots
Expected behavior
Pinch and pan in the same time.
Actual behavior
See video above.
Snack or minimal code example
const scale = useSharedValue(1)
const translateX = useSharedValue(0)
const translateY = useSharedValue(0)
const pinchGesture = Gesture.Pinch()
.onBegin(e => {
runOnJS(props.onPinchImage)(props.postActivityId)
})
.onUpdate((e) => {
scale.value = e.scale
})
.onEnd(() => {
scale.value = withTiming(1)
})
const panGesture = Gesture.Pan()
panGesture.enableTrackpadTwoFingerGesture(true)
panGesture.minPointers(2)
panGesture
.onUpdate(e => {
'worklet'
translateX.value = e.translationX
translateY.value = e.translationY
})
panGesture
.onEnd(e => {
'worklet'
translateX.value = withTiming(0)
translateY.value = withTiming(0)
})
const composed = Gesture.Simultaneous(pinchGesture, panGesture)
const animatedStyle = useAnimatedStyle(() => {
return {
zIndex: 50,
transform: [
{ scale: scale.value },
{ translateX: translateX.value },
{ translateY: translateY.value },
],
}
})
return (
<GestureDetector gesture={composed}>
<Animated.View style={animatedStyle}>
<Image
source={{ uri: props.uri }}
ratio={props.ratio}
style={[ tailwind.style('self-center') ]}
/>
</Animated.View>
</GestureDetector>
)
Package versions
- React:
17.0.1
- React Native:
0.64.3
- React Native Gesture Handler:
~2.1.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Relativity of simultaneity - Wikipedia
In physics, the relativity of simultaneity is the concept that distant simultaneity – whether two spatially separated events occur at the same time...
Read more >What did Einstein mean when he said, 'events which ... - Quora
The point he was making is that the idea of simultaneous is not an absolute thing, but is dependent on your reference frame....
Read more >Special Relativity Simultaneity - University of Pittsburgh
There is no absolute fact as to whether two spatially separated events are simultaneous. There is only a fact of simultaneity or its...
Read more >Nonsimultaneous Definition & Meaning - Merriam-Webster
The meaning of NONSIMULTANEOUS is not existing or occurring at the same time : not simultaneous. How to use nonsimultaneous in a sentence....
Read more >Simultaneous Events - UCR Math Department
If you find that they didn't happen at the same time for you, then no, they were not simultaneous in your frame.
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 FreeTop 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
Top GitHub Comments
Thanks! It seems like this problems occurs only on managed Expo workflow, I’ll look into it.
Hi, unfortunately I’ve been unable to reproduce this issue based on the snippet alone. Could you prepare a repository with a reproduction?