From 0d45e9eb029c474d1df65149bde7d2e50aef1e38 Mon Sep 17 00:00:00 2001 From: mariano Date: Fri, 27 Sep 2019 00:03:05 -0300 Subject: [PATCH] added new property in case of images width are smaller thant window --- ImageSlider.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ImageSlider.js b/ImageSlider.js index 07ce98d..bf5fc8a 100644 --- a/ImageSlider.js +++ b/ImageSlider.js @@ -34,6 +34,7 @@ type PropsType = { onPress?: Object => void, customButtons?: (number, (number, animated?: boolean) => void) => Node, customSlide?: Slide => Node, + imagesWidth: number }; type StateType = { @@ -75,7 +76,9 @@ class ImageSlider extends Component { return; } const isUpdating = index !== this._getPosition(); - const x = Dimensions.get('window').width * index; + const x = (this.props.imagesWidth ? + this.props.imagesWidth : Dimensions.get("window").width) + * index; this._ref && this._ref.scrollTo({ y: 0, x, animated });