React-native-web: ScrollView: support for pagingEnabled prop

Created on 31 Jul 2018  Â·  5Comments  Â·  Source: necolas/react-native-web

Hi, I'm using the version '0.8.9' of 'react-native-web' and 'pagingEnabled' prop in 'ScrollView' not work.
Any Idea?

Thank you

All 5 comments

Neither pagingEnabled nor stick headers is currently working out of the box, it seems #434 was not completed.

For now you can do something like this:

<ScrollView className="snap-container" horizontal pagingEnabled>
  <View className="snap-item-start">{/* ... */}</View>
  <View className="snap-item-start">{/* ... */}</View>
</ScrollView>

index.css

.snap-container {
  scroll-snap-type: x mandatory;
}

.snap-item-start {
  scroll-snap-align: start;
}

Works on Chrome and Safari. (caniuse)

Hi, all, is there any new idea for pagingEnabled?

without pagingEnabled, swiper like react-native-swiper can not work in the browser。

@necolas Would you be willing to accept a PR which adds the CSS properties from @brunolemos example when pagingEnabled is set to true?

At least it seems to me that it works exactly the same way as pagingEnabled on the native side. Of course it might be that there are some cases where it would work in a differently from the native implementation.

The browser support is only Safari, iOS Safari, Chrome and Android Chrome. Edge and Firefox only support an older version of the spec which does not have the scroll-snap-align property that is needed. There is also a polyfill for CSS scroll snap, but at least I could not get it to work with RNW.

Yep! That covers most browsers in significant use. Edge will be moving to Blink. And Firefox will catch up eventually.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SamyPesse picture SamyPesse  Â·  3Comments

ricklove picture ricklove  Â·  3Comments

bcpugh picture bcpugh  Â·  3Comments

rohanprabhu picture rohanprabhu  Â·  3Comments

zhangking picture zhangking  Â·  3Comments