Open
Description
Describe the bug
Transaction inside gestures .onChange
, doesn't work, below code should animate rectangle fill color between the states.
To Reproduce
Steps to reproduce the behavior:
Rectangle()
.fill(self.isDetectingLongPress ? Color.pink : (self.completedLongPress ? Color.purple : Color.gray))
.frame(width: 100, height: 100)
.gesture(LongPressGesture(minimumDuration: 2)
.updating($isDetectingLongPress) { currentState, gestureState, transaction in
gestureState = currentState
transaction.animation = Animation.easeIn(duration: 2.0)
}
.onEnded { finished in
self.completedLongPress = finished
})
Expected behavior
Rectangle should be animated.