software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.59k stars 1.26k forks source link

Fix duration of fading transition #6174

Open Latropos opened 3 days ago

Latropos commented 3 days ago

Summary

Now the fading transition executes for 2*duration miliseconds. We should divide the duration by 2 to fix it, the same way it done for the following transitions:

https://github.com/software-mansion/react-native-reanimated/blob/82d1d9582d96b463ab95d6ba9b8c1c20e7aa867b/packages/react-native-reanimated/src/layoutReanimation/defaultTransitions/JumpingTransition.ts#L33

https://github.com/software-mansion/react-native-reanimated/blob/82d1d9582d96b463ab95d6ba9b8c1c20e7aa867b/packages/react-native-reanimated/src/layoutReanimation/defaultTransitions/SequencedTransition.ts#L44

Also I rename the variables that hold half of the duration and are named "duration" into "halfDuration", as it was suggested during the review

Test plan

Tests are in this PR: https://github.com/software-mansion/react-native-reanimated/pull/6168