intellidev1991/react-native-image-slider-box

circleLoop not working properly

YankovWeb opened this issue ยท 3 comments

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch react-native-image-slider-box@2.0.7 for the project I'm working on.

circleLoop not working properly is scrolling to the first image and is not looking as infinity loop.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-image-slider-box/dist/SliderBox.js b/node_modules/react-native-image-slider-box/dist/SliderBox.js
index 476963c..a2f4b32 100644
--- a/node_modules/react-native-image-slider-box/dist/SliderBox.js
+++ b/node_modules/react-native-image-slider-box/dist/SliderBox.js
@@ -58,7 +58,7 @@ export class SliderBox extends Component {
   }
 
   onSnap(index) {
-    this._ref.snapToItem(index);
+    //this._ref.snapToItem(index);
     const { currentImageEmitter } = this.props;
     this.setState({ currentImage: index }, () => {
       if (currentImageEmitter) {

This issue body was partially generated by patch-package.

how can I use this patch?

how can I use this patch?

Go to this file in your project

node_modules/react-native-image-slider-box/dist/SliderBox.js

And find the red line and change it with the green line.
then use patch:

https://www.npmjs.com/package/patch-package

To be able to share the changes in git repo.

thanks for the quick response!