From 2a0d52c4c83063bd4aaabb6b28902a12a0cd8ee2 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Tue, 17 Sep 2019 10:55:05 +0200 Subject: [PATCH] Update ParallaxSwiper.js --- src/ParallaxSwiper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ParallaxSwiper.js b/src/ParallaxSwiper.js index 4b11e36..bb9bd8d 100644 --- a/src/ParallaxSwiper.js +++ b/src/ParallaxSwiper.js @@ -169,7 +169,7 @@ class ParallaxSwiper extends Component { inputRange: [ 0, (this.state.width + dividerWidth) * - (children.length - 1), + Math.max(children.length - 1, 1), ], outputRange: [-this.state.width, 0], extrapolate: 'clamp', @@ -180,7 +180,7 @@ class ParallaxSwiper extends Component { ? animatedValue.interpolate({ inputRange: [ 0, - this.state.height * (children.length - 1), + this.state.height * Math.max(children.length - 1, 1), ], outputRange: [-this.state.height, 0], extrapolate: 'clamp',