Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,20 @@ class ParallaxScrollView extends Component {
const { viewWidth, scrollY } = this.state;
if (renderStickyHeader || renderFixedHeader) {
const p = pivotPoint(parallaxHeaderHeight, stickyHeaderHeight);
let height = interpolate(scrollY, {
inputRange: [0, stickyHeaderHeight],
outputRange: [0, stickyHeaderHeight],
extrapolate: 'clamp'
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe height need to be declared as const, don't see it changing later in code.
Also maybe it could be replaced with call to interpolate in View parameters, similar to opacity

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: height,
opacity: interpolate(scrollY, {
inputRange: [0, p],
outputRange: [0, 1],
Expand Down