Skip to content

Commit 260ca6d

Browse files
Events are not passed through to the foreground view if STICKY_HEADER_HEIGHT overlaps i6mi6#25
1 parent 5c3c92f commit 260ca6d

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/index.js

+10-13
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class ParallaxScrollView extends Component {
6969

7070
animatedEvent = Animated.event(
7171
[{ nativeEvent: { contentOffset: { y: this.scrollY } } }],
72-
{ useNativeDriver: true }
72+
// { useNativeDriver: true }
7373
)
7474

7575
render() {
@@ -140,7 +140,7 @@ class ParallaxScrollView extends Component {
140140
// Using Native Driver greatly optimizes performance
141141
onScroll: Animated.event(
142142
[{ nativeEvent: { contentOffset: { y: this.scrollY } } }],
143-
{ useNativeDriver: true, listener: this._onScroll.bind(this) }
143+
{ listener: this._onScroll.bind(this) }
144144
)
145145
// onScroll: this._onScroll.bind(this)
146146
},
@@ -372,22 +372,19 @@ class ParallaxScrollView extends Component {
372372
const { viewWidth } = this.state
373373
const { scrollY } = this
374374
if (renderStickyHeader || renderFixedHeader) {
375-
const p = pivotPoint(parallaxHeaderHeight, stickyHeaderHeight)
375+
const p = pivotPoint(parallaxHeaderHeight, stickyHeaderHeight);
376+
let height = interpolate(scrollY, {
377+
inputRange: [0, stickyHeaderHeight],
378+
outputRange: [0, stickyHeaderHeight],
379+
extrapolate: 'clamp'
380+
});
376381
return (
377-
<View
378-
style={[
379-
styles.stickyHeader,
380-
{
381-
width: viewWidth,
382-
...(stickyHeaderHeight ? { height: stickyHeaderHeight } : null)
383-
}
384-
]}
385-
>
382+
<View style={[styles.stickyHeader, { width: viewWidth }]}>
386383
{renderStickyHeader
387384
? <Animated.View
388385
style={{
389386
backgroundColor: backgroundColor,
390-
height: stickyHeaderHeight,
387+
height,
391388
opacity: interpolate(scrollY, {
392389
inputRange: [0, p],
393390
outputRange: [0, 1],

0 commit comments

Comments
 (0)