Skip to content

Why is decelerationRate set to 0.88 for the FlatList used by DurationScroll? #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Off2Race opened this issue Apr 23, 2025 · 5 comments

Comments

@Off2Race
Copy link

Hello! While testing the TimerPicker component in my app, the scrolling behavior seems "sluggish" to me on iOS. In other words, if I spin the duration controls, it stops more quickly than I would expect.

I looked in the code and noticed that the decelerationRate prop is set to 0.88 for the internal FlatList component used by the DurationScroll component, which seems to be the cause.

QUESTIONS
1 – Why is this decelerationRate prop hardcoded to this value? I'm assuming it must be done for a reason :)
2 – Have you considered adding a decelerationRate prop to TimerPicker that would pass down so that users of the component can control it?

I'll likely create a patch so I can workaround this problem for myself but I figured I'd log this issue to raise the question.

@troberts-28
Copy link
Owner

Hey @Off2Race, thanks for raising this.

The 0.88 deceleration rate was added to make the picker land on a value relatively quickly after a hefty scroll. It was a UX-preference rather than anything technical, so completely agree that it should be possible to change it with a prop.

I can get this added when I next do some work on the library, or feel free to create a PR to get it merged sooner!

@Off2Race
Copy link
Author

Hi, @troberts-28 – Thanks for the quick response. I'll give it a shot and send you the PR!

@Off2Race
Copy link
Author

Off2Race commented Apr 24, 2025

Hi, @troberts-28 – I noticed a couple of unrelated issues while working on this:

1 – There's a bug in the start-bare:ios script. It looks like someone might have inadvertently copied start-bare:android and didn't change the platform parameter. I thought about just fixing it but figured you might want to keep the PRs single-purpose.

2 – I followed the Contributing instructions but the yarn setup command would not work for me. Not sure why. Could be that I have an older version of yarn installed globally. In any case, I was able to do yarn install so it wasn't a blocking issue. But I thought I'd mention it in case you wanted to make a note in the instructions.

@troberts-28
Copy link
Owner

Thank you for pointing these out! Will address them in the next release ✅

@Off2Race
Copy link
Author

Welcome! Here's the PR – #57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants