oliviertassinari / react-swipeable-views

A React component for swipeable views. :snowflake:
https://react-swipeable-views.com/
MIT License
4.46k stars 480 forks source link

Changing "index" along with "animateTransitions=false" still result in transition #642

Open goffioul opened 3 years ago

goffioul commented 3 years ago

I have a use case whereby a SwipeableViews component is initially rendered with animateTransitions=true and a given index. Later on, the component is re-rendered with a change of index and animateTransitions=false at the same time. The problem is that this still result in a animated transition.

From what I can see, this is due to the fact that the new transform (due to new index) is handled in UNSAFE_componentWillReceiveProps/setIndexCurrent, while animateTransitions=false is handled in render, which occurs after.