reactrondev / react-native-web-swiper

Swiper-Slider for React-Native and React-Native-Web
213 stars 55 forks source link

Bouces disable? #75

Open Victorcassiano opened 2 years ago

Victorcassiano commented 2 years ago

How to disable this stretched animation?

jarvisluong commented 2 years ago

Do you have a reproducible example? @Victorcassiano

Victorcassiano commented 2 years ago

Do you have a reproducible example? @Victorcassiano

the gif shows the screen stretching when dragging, there would be no way to remove that?

jarvisluong commented 2 years ago

Do you have a reproducible example? @Victorcassiano

the gif shows the screen stretching when dragging, there would be no way to remove that?

sorry, I didn't really get what was the issue

oxyii commented 2 years ago

@jarvisluong @Victorcassiano wanna to disallow gestures < 0 and > width.

I think it's some additional logic here https://github.com/reactrondev/react-native-web-swiper/blob/6d007d23ccefd33936b0a7fe90d66f58142c2a03/src/Swiper.js#L110-L112

oxyii commented 2 years ago

something like this:

var allow = false;
const changeRequest = vertical ? gestureState.dy : gestureState.dx;
   // if not is last slide -> allow move right                // if not is first slide -> allow move left
if ((activeIndex + 1 < slidesCount  && changeRequest > 0) || (activeIndex > 0 && changeRequest < 0)) {
  allow = Math.abs(changeRequest) > minDistanceToCapture;
}
jarvisluong commented 2 years ago

I guess what we can do is to expose onMoveShouldSetPanResponderCapture and let user override that logic if needed. How do you think about this approach? @oxyii

oxyii commented 2 years ago

@jarvisluong I really don't care ))) I don't even work with react anymore. I just explained what @Victorcassiano want.