React-native-snap-carousel: How to disable the gesture?

Created on 30 Jul 2017  路  8Comments  路  Source: meliorence/react-native-snap-carousel

Hi,

I want to use this component to achieve a function like a wizard, which means I don't want to use the figure to drag into next screen. I just want to use snapToNext to switch. I don't find an attribute can set it, so how can I implement this effect?

Cheers

enhancement

Most helpful comment

Hi @wangdicoder,

In the end, there is no need for specific code: ScrollView already has the required prop scrollEnabled. Since Carousel inherits ScrollView's props, you can use it right away ;-)

All 8 comments

Hi @wangdicoder,

Currently, there is no way to disable gesture events. It's not a common use case, but I will look into adding a specific prop for that as soon as possible ;-)

Yes, if you could implement this function, that will be great. I'm looking forward the good news. 馃憤馃憤馃憤 Thanks

Hi @wangdicoder,

In the end, there is no need for specific code: ScrollView already has the required prop scrollEnabled. Since Carousel inherits ScrollView's props, you can use it right away ;-)

@bd-arc
How do I implement that Swap disabling feature in this code?

style={{ marginRight: 10 }}
layout={"default"}
ref={c => {
this.carousel = c;
}}
loop
data={this.state.entries}
renderItem={this._renderItem}
sliderWidth={500}
itemWidth={400}
layout={"stack"}
layoutCardOffset={18}
loopClonesPerSide={1}
onSnapToItem={index => {
console.log(index);
}}
/>

@RamMahe1110 <Carousel scrollEnabled={false} />

@bd-arc Not able to disable the scrolling using scrollEnabled={false}.

@shivam21197 It works for me.

@bd-arc Should be added to the doc as I was about to drop this plugin until I saw that issue. I think it's a pretty common use case to do wizard with such plugins :)

@Masadow It's actually part of the doc already, but I will add this prop's description here so that users have a better chance of finding it :-)

Was this page helpful?
0 / 5 - 0 ratings