Tokamak icon indicating copy to clipboard operation
Tokamak copied to clipboard

Transaction doesn't work for GestureStateGesture

Open shial4 opened this issue 2 years ago • 1 comments

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.

shial4 avatar Aug 19 '23 22:08 shial4

https://github.com/TokamakUI/Tokamak/pull/538#discussion_r1299235524

shial4 avatar Aug 19 '23 22:08 shial4