react-native-animatable
react-native-animatable copied to clipboard
Fix transitions aborting on repeated style values
Before this fix the following could happen:
- Button receives props { otherProp: valA style: {translateY: 50} }
- Transition starts to translate button to 50.
- While transition is happening Button receives the following props { otherProp: valB style: {translateY: 50} }
- Transition is aborted and Button "jerks" to the target state of the transition.
This update makes react-native-animatable ignore repeated style props and only start transitions when new values are received.
I'm not fully content with this fix. While it's sensible to only start transitions for changed styles transitions will still jerk if new style props are received while a transition is running. E.g:
- translation 50 prop received
- starts transition
- translation 90 prop received
- aborts previous transition and starts transition from 50 to 90, causing the element to jerk to 50
This does not happen with a normal Animation.Value which would just update the running transition to animate to 90 from whatever position it's currently in.
Fixed the above for animations not using interpolation. Still exists in those that do.