nickmcmillan / react-physics-dragger

A simple, no-frills horiztonal dragger/slider with physics
202 stars 10 forks source link

Fix for crash when you switch route but anim is still going on #33

Closed losrobbos closed 3 years ago

losrobbos commented 4 years ago

Hi Nick,

a great library, students of mine like it at lot :)

There is just a little issue with crashes, when you use the library together with React-Router.

When you perform a slide which is not completed yet and meanwhile switch the route (some people really do that ;)) then setting the given ref in the given line (see fix in file) will be undefined. And cause the crash. The little if check before setting the ref prevents that and makes it more stable.

Hope it gets included, it's just just a very small fix :)

Cheers from Berlin Rob

nickmcmillan commented 3 years ago

Sorry for not seeing this until now @losrobbos Looks good to me, thanks for your contribution!