diff --git a/src/index.js b/src/index.js index 8787b6f..e26757d 100644 --- a/src/index.js +++ b/src/index.js @@ -154,8 +154,8 @@ class ParallaxScrollView extends Component { } /* - * Expose `ScrollView` API so this component is composable with any component that expects a `ScrollView`. - */ + * Expose `ScrollView` API so this component is composable with any component that expects a `ScrollView`. + */ getScrollResponder() { return this.refs[SCROLLVIEW_REF]._component.getScrollResponder() } @@ -173,8 +173,8 @@ class ParallaxScrollView extends Component { } /* - * Private helpers - */ + * Private helpers + */ _onScroll(e) { const { @@ -252,7 +252,7 @@ class ParallaxScrollView extends Component { { translateY: interpolate(scrollY, { inputRange: [0, p], - outputRange: [0, -(p / backgroundScrollSpeed)], + outputRange: [0, backgroundScrollSpeed === 0 ? 0 : -(p / backgroundScrollSpeed)], extrapolateRight: 'extend', extrapolateLeft: 'clamp' }) @@ -371,6 +371,7 @@ class ParallaxScrollView extends Component { }) { const { viewWidth } = this.state const { scrollY } = this + const { backgroundScrollSpeed } = this.props; if (renderStickyHeader || renderFixedHeader) { const p = pivotPoint(parallaxHeaderHeight, stickyHeaderHeight) return ( @@ -401,7 +402,7 @@ class ParallaxScrollView extends Component { { translateY: interpolate(scrollY, { inputRange: [0, p], - outputRange: [stickyHeaderHeight, 0], + outputRange: [backgroundScrollSpeed === 0 ? 0 : stickyHeaderHeight, 0], extrapolate: 'clamp' }) }