Skip to content
Open
Show file tree
Hide file tree
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: 3 additions & 6 deletions example/Pages/BasicUsage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ class BasicUsage extends React.Component {
maxHeight={200}
minHeight={MIN_HEIGHT}
renderHeader={() => <Image source={require('../assets/NZ.jpg')} style={styles.image} />}
renderForeground={() =>
<View style={{ height: 150, justifyContent: 'center', alignItems: 'center' }}>
<TouchableOpacity onPress={() => console.log('tap!!')}>
<Text style={{ backgroundColor: 'transparent' }}>Tap Me!</Text>
</TouchableOpacity>
</View>}
renderForeground={() => <View />}
renderFixedForeground={() => <View />}
renderTouchableFixedForeground={() => <View />}
>
<View style={{ height: 1000 }}>
<TriggeringView onHide={() => console.log('text hidden')}>
Expand Down
26 changes: 19 additions & 7 deletions src/ImageHeaderScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ class ImageHeaderScrollView extends Component<DefaultProps, Props, State> {
];

return (
<Animated.View style={[styles.header, headerTransformStyle]}>
<Animated.View style={[styles.header, headerTransformStyle, { backgroundColor: 'red' }]}>
{this.props.renderHeader()}
<Animated.View style={overlayStyle} />
<View style={styles.fixedForeground}>
<View style={[styles.fixedForeground, { backgroundColor: 'blue' }]}>
{this.props.renderFixedForeground()}
</View>
</Animated.View>
Expand All @@ -146,7 +146,7 @@ class ImageHeaderScrollView extends Component<DefaultProps, Props, State> {
opacity: this.props.fadeOutForeground ? opacity : 1,
};
return (
<Animated.View style={[styles.header, headerTransformStyle]}>
<Animated.View style={[styles.header, headerTransformStyle, { backgroundColor: 'yellow' }]}>
{this.props.renderForeground()}
</Animated.View>
);
Expand All @@ -171,7 +171,14 @@ class ImageHeaderScrollView extends Component<DefaultProps, Props, State> {
};

return (
<Animated.View style={[styles.header, styles.touchableFixedForeground, headerTransformStyle]}>
<Animated.View
style={[
styles.header,
styles.touchableFixedForeground,
headerTransformStyle,
{ backgroundColor: 'orange' },
]}
>
{this.props.renderTouchableFixedForeground()}
</Animated.View>
);
Expand Down Expand Up @@ -200,7 +207,7 @@ class ImageHeaderScrollView extends Component<DefaultProps, Props, State> {

const childrenContainerStyle = StyleSheet.flatten([
{ transform: [{ translateY: headerScrollDistance }] },
{ backgroundColor: 'white', paddingBottom: maxHeight },
{ backgroundColor: 'pink', paddingBottom: maxHeight },
childrenStyle,
]);

Expand All @@ -211,10 +218,15 @@ class ImageHeaderScrollView extends Component<DefaultProps, Props, State> {
onLayout={() => this.container.measureInWindow((x, y) => this.setState({ pageY: y }))}
>
{this.renderHeader()}
<Animated.View style={[styles.container, { transform: [{ translateY: topMargin }] }]}>
<Animated.View
style={[
styles.container,
{ transform: [{ translateY: topMargin }], backgroundColor: 'black' },
]}
>
<ScrollView
ref={ref => (this.scrollViewRef = ref)}
style={styles.container}
style={[styles.container, { backgroundColor: 'green' }]}
scrollEventThrottle={16}
onScroll={Animated.event([
{ nativeEvent: { contentOffset: { y: this.state.scrollY } } },
Expand Down