use-smooth-scroll
use-smooth-scroll copied to clipboard
scroll duration is hardcoded
I believe this would be a very useful feature since diferent scroll content/distances would (in certain scenarios) work best with custom scroll durations.
Let me know and I might submit a PR.
It's not hardcoded - it only has a default value. You can call received scrollTo like this:
scrollTo(target, { duration: 1000 })
duration can even also be a function which receives computed distance as an argument - see this:
https://github.com/Andarist/use-smooth-scroll/blob/6539b5ab4de753ecbc92fdcf74dc0c0a624b0b6f/src/index.js#L47-L52
Thank you for your fast response. Overriding is not working for me in this example sandbox: https://codesandbox.io/s/focused-wozniak-i5dvu
It's working fine - https://codesandbox.io/s/admiring-kalam-pxs9l .
You have not actually used implemented scrollToBottom which is using duration option, but rather was using inline handler which wasnt passing any additional options to scrollTo.