我正在试着把旋转木马的末端向右对齐。
我是这样定义Carousel的:
<Carousel
data={pointsOfSale}
firstItem={0}
renderItem={renderItem}
sliderWidth={sliderWidth}
itemWidth={itemWidth}
hasParallaxImages
containerCustomStyle={{
marginStart: theme.mixins.widthPercentageToDP(2),
}}
inactiveSlideScale={1}
inactiveSlideOpacity={1}
activeSlideAlignment="start"
/>有了activeSlideAlignment="start"属性,我就可以将旋转木马的起点向左对齐。但是,如果我滚动到最后,最后一项将与左侧对齐(与第一项的位置相同)。我希望最后一项保持在正确的位置,就像FlatList一样。
当前行为:

我想避开那些空位。
我使用的是React Native 0.62.2和react-native-snap-carousel 3.9.0。
发布于 2020-05-28 07:13:54
答:在3.x版本的插件中是不可能的。
然而,这是在版本4中使用prop useExperimentalSnap实现的。它目前还处于测试阶段。
https://stackoverflow.com/questions/61860879
复制相似问题