Skip to content

Option to control ScrollView pagingEnabled scroll-snap-align value #1250

Open
@MoOx

Description

@MoOx

Is your feature request related to a problem? Please describe.

pagingEnabled has been implemented #1212 using scroll-snap (which is a good idea imo).
But there is a major difference with native paging feature. RN ScrollView stops on multiples of the scroll view's size when scrolling., which is quite different.
Not a big deal imo since scroll snap is nicer in most case.
Well "it depends" on what you want to do obviously.

Anyway, I would like to be able to control the scroll-snap-align value. Currently, start is hardcoded, and depending on what you render, using center or end could make more sense.
RN have another (unimplemented in RNW) solution than pagingEnabled, which is spread into 2 props snapToInterval & snapToAlignment. Interval make sense if elements in the scrollview don't have the same width as the scroll view, and that's where snapToAlignment comes to help you align the "sort of pagination".

Describe a solution you'd like

I think we could very easily just implement snapToAlignment to control pagingEnabled scroll-snap-align value. As we already have a small difference with the native version (which is better imo, thanks to scroll snap) we could accept this prop. Obviously, this make us even more different from native rendering, but would help us "on both side", as if you use RN scroll view snapToInternal/Align props, pagingEnabled is ignored.
And if you have pagingEnable + snapToAlignment and no snapToInterval, pagingEnabled works & snapToAlignment have no effect, which won't be problem for cross platform code.

Describe alternatives you've considered

We could implement snapToInterval & snapToAlignment but that would require probably way more work and will probably make a less desirable effect at the end, cause no scroll snap involved (I guess, since interval is a number...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions