stipsan / react-spring-bottom-sheet

Accessible ♿️, Delightful ✨, & Fast 🚀
https://react-spring.bottom-sheet.dev/
MIT License
951 stars 130 forks source link

Control speed of animation #30

Open yairhaimo opened 3 years ago

yairhaimo commented 3 years ago

Is there a way to control the speed of the animation? Specifically using the snapTo method.

(Awesome, awesome library!)

stipsan commented 3 years ago

Heya, react-spring support it. If I expose it like this:

ref.current.snapTo(({maxHeight}) => maxHeight, {duration: 250})

would that work for you?

yairhaimo commented 3 years ago

That would be great. Thanks!

simonrelet commented 3 years ago

Hello there! @stipsan Huge thanks for the library 🙏

Would it be conceivable to also have an API to set the duration/spring config at the component level? ref.current.snapTo() could "use it" by default and override it if a config is passed as parameter.

What do you think?

stipsan commented 3 years ago

@simonrelet yes that is the idea. The reason I've held off on it though is that these options are different in the upcoming version of react-spring, v9. I could compromise on using an unstable_ prefix on this prop/option while we're on v8. If I add it now understand that these options will be a "use at your own risk" kind of deal.

otox-rz commented 3 years ago

Hi @stipsan , I think we will have the good news soon .

Release Plan v9 of react-spring

ejabu commented 3 years ago

Hi @stipsan , we have a good news from React Spring side.

Finally the version 9 is merged

stipsan commented 3 years ago

Brilliant 🎉 Btw, @otox-rz and @ejabu, what's up with the 🍔 themed avatars? 😂

ejabu commented 3 years ago

Brilliant 🎉 Btw, @otox-rz and @ejabu, what's up with the 🍔 themed avatars? 😂

lol, I had to create another account to conform my office rules, using Work email for git user. 🤣

Agrejus commented 1 year ago

FYI - Here is an answer for changing the speed

https://github.com/stipsan/react-spring-bottom-sheet/issues/151#issuecomment-1368631716