Skip to content

Commit

Permalink
Events are not passed through to the foreground view if STICKY_HEADER…
Browse files Browse the repository at this point in the history
…_HEIGHT overlaps i6mi6#25
  • Loading branch information
tavriaforever authored Jun 20, 2018
1 parent 5c3c92f commit 260ca6d
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ParallaxScrollView extends Component {

animatedEvent = Animated.event(
[{ nativeEvent: { contentOffset: { y: this.scrollY } } }],
{ useNativeDriver: true }
// { useNativeDriver: true }
)

render() {
Expand Down Expand Up @@ -140,7 +140,7 @@ class ParallaxScrollView extends Component {
// Using Native Driver greatly optimizes performance
onScroll: Animated.event(
[{ nativeEvent: { contentOffset: { y: this.scrollY } } }],
{ useNativeDriver: true, listener: this._onScroll.bind(this) }
{ listener: this._onScroll.bind(this) }
)
// onScroll: this._onScroll.bind(this)
},
Expand Down Expand Up @@ -372,22 +372,19 @@ class ParallaxScrollView extends Component {
const { viewWidth } = this.state
const { scrollY } = this
if (renderStickyHeader || renderFixedHeader) {
const p = pivotPoint(parallaxHeaderHeight, stickyHeaderHeight)
const p = pivotPoint(parallaxHeaderHeight, stickyHeaderHeight);
let height = interpolate(scrollY, {
inputRange: [0, stickyHeaderHeight],
outputRange: [0, stickyHeaderHeight],
extrapolate: 'clamp'
});
return (
<View
style={[
styles.stickyHeader,
{
width: viewWidth,
...(stickyHeaderHeight ? { height: stickyHeaderHeight } : null)
}
]}
>
<View style={[styles.stickyHeader, { width: viewWidth }]}>
{renderStickyHeader
? <Animated.View
style={{
backgroundColor: backgroundColor,
height: stickyHeaderHeight,
height,
opacity: interpolate(scrollY, {
inputRange: [0, p],
outputRange: [0, 1],
Expand Down

0 comments on commit 260ca6d

Please sign in to comment.