简体   繁体   中英

ScrollTo animation react-spring

As per title, all I'm trying to achieve is to scroll to some element smoothly by using react-spring animations.

Here I reproduced a snippet with a working example (which when clicking on a section brings you to the following one); Problem is this works only on versions below v6.0.0 .

As you can notice on index.js , I added a commented line with a component which contains the exact same logic but converted to v9.1.2 (which doesn't work).

So question is, what part did I convert wrongly? I am probably missing some bits from breaking changes on v6 and I tried looking into the documentation, but they reference to breaking changes for v8 and v9 only, so I'm a bit confused on what I'm missing?

Any answer with a working solution it's perfectly fine, doesn't need to be based on my example - big thank you in advance!

The version 9.1.2 seems to have some bugs which might be causing this. I found an issue which also states the same problems. (Also, the original issue that found this )

So, according to their releases , version 9.2.0 or upwards would have this issue fixed. I tried 9.2.1 (latest at the time of this answer) in the sandbox provided in the question and it works:

Forked Sandbox (working)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM