meliorence / react-native-snap-carousel

Swiper/carousel component for React Native featuring previews, multiple layouts, parallax images, performant handling of huge numbers of items, and more. Compatible with Android & iOS.
BSD 3-Clause "New" or "Revised" License
10.36k stars 2.29k forks source link

Fast scrolling in validation don't have option to prevent scroll to next index. #646

Open rushi-biznovare opened 4 years ago

rushi-biznovare commented 4 years ago

Is this a bug report, a feature request, or a question?

(bug report)

Have you followed the required steps before opening a bug report?

(Check the step you've followed - put an x character between the square brackets ([]).)

Have you made sure that it wasn't a React Native bug?

(not a react-native bug.)

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

(I don't know about android. I am checking on ios)

Is the bug reproductible in a production environment (not a debug one)?

(both production and debug)

Environment

Environment: React: 16.8.6 React native: 0.60.5 react-native-snap-carousel: 3.8.4

Target Platform: iOS (12.4)

Expected Behavior

there is not way to prevent scroll programatically ie. for validation.

Actual Behavior

there is prop scrollEnabled is there. but it's not working not validation if it's have some long process function and if we scroll fast. ie. scrollEnabled={this.state.scrollEnabled} onScroll={this.onScrollPageesss}

onScrollPageesss() {
...
... long validation function
...
 return result 
this.setState({scrollEnabled: result})
}

Reproducible Demo

https://snack.expo.io/S1XZbsHfU

Steps to Reproduce

(Write your steps so that anyone can reproduce the issue in the Snack demo you provided.)

  1. write long validation function onScroll for prevent scroll
  2. just scroll fast, its scroll the next render item without executing current condition Screen Shot 2020-02-03 at 7 05 50 PM
dohooo commented 3 years ago

Sorry, please allow me to advertise for my open source library! ~ I think this library react-native-reanimated-carousel will solve your problem. It is a high performance and very simple component, complete with React-Native reanimated 2