Skip to content

Commit 732c07d

Browse files
authored
Move sticky header out of the way so foreground touches work
temp fix. wait for main repo updated
1 parent 5c3c92f commit 732c07d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Diff for: src/index.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,22 @@ class ParallaxScrollView extends Component {
371371
}) {
372372
const { viewWidth } = this.state
373373
const { scrollY } = this
374+
375+
const translateY = interpolate(scrollY, {
376+
inputRange: [0, stickyHeaderHeight],
377+
outputRange: [-stickyHeaderHeight, 0],
378+
extrapolate: 'clamp'
379+
})
380+
374381
if (renderStickyHeader || renderFixedHeader) {
375382
const p = pivotPoint(parallaxHeaderHeight, stickyHeaderHeight)
376383
return (
377-
<View
384+
<Animated.View
378385
style={[
379386
styles.stickyHeader,
380387
{
381388
width: viewWidth,
389+
transform: [{ translateY }],
382390
...(stickyHeaderHeight ? { height: stickyHeaderHeight } : null)
383391
}
384392
]}
@@ -388,8 +396,9 @@ class ParallaxScrollView extends Component {
388396
style={{
389397
backgroundColor: backgroundColor,
390398
height: stickyHeaderHeight,
399+
transform: [{ translateY }],
391400
opacity: interpolate(scrollY, {
392-
inputRange: [0, p],
401+
inputRange: [stickyHeaderHeight, p],
393402
outputRange: [0, 1],
394403
extrapolate: 'clamp'
395404
})
@@ -413,7 +422,7 @@ class ParallaxScrollView extends Component {
413422
</Animated.View>
414423
: null}
415424
{renderFixedHeader && renderFixedHeader()}
416-
</View>
425+
</Animated.View>
417426
)
418427
} else {
419428
return null

0 commit comments

Comments
 (0)