Skip to content

Commit 14b3344

Browse files
committed
adds defaults to renderBackground and renderParallaxHeader
1 parent 56b6f5d commit 14b3344

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

index.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ParallaxScrollView extends Component {
3939
console.error('Property `stickyHeaderHeight` must be set if `renderStickyHeader` is used')
4040
}
4141
this.state = { scrollY: new Animated.Value(0) };
42-
this._footerComponent = null;
42+
this._footerComponent = { setNativeProps() {} }; // Initial stub
4343
this._footerHeight = 0;
4444
this._animatedEvent = Animated.event([{nativeEvent: { contentOffset: { y: this.state.scrollY } } }]);
4545
}
@@ -154,7 +154,7 @@ class ParallaxScrollView extends Component {
154154
}]
155155
}]}>
156156
<View>
157-
{ renderBackground && renderBackground() }
157+
{ renderBackground() }
158158
</View>
159159
</Animated.View>
160160
);
@@ -177,7 +177,7 @@ class ParallaxScrollView extends Component {
177177
extrapolate: 'extend'
178178
})
179179
}]}>
180-
{ renderParallaxHeader && renderParallaxHeader() }
180+
{ renderParallaxHeader() }
181181
</Animated.View>
182182
</View>
183183
);
@@ -247,6 +247,8 @@ class ParallaxScrollView extends Component {
247247
ParallaxScrollView.propTypes = IPropTypes;
248248

249249
ParallaxScrollView.defaultProps = {
250+
renderBackground: () => <View/>,
251+
renderParallaxHeader: () => <View/>,
250252
headerBackgroundColor: '#000',
251253
contentBackgroundColor: '#fff',
252254
onChangeHeaderVisibility: () => {},

0 commit comments

Comments
 (0)