Cannot tap element on renderFixedForeground
See original GitHub issueHi, tanks for this amazing component. I’m having an issue tapping on a button inside the renderFixedForeground. When I scroll down and the header collapses, it works perfectly.
In the following example you can see that the button is not tappable until you scroll all the way down. Thanks in advance.
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
Button
} from 'react-native';
import HeaderImageScrollView, { TriggeringView } from 'react-native-image-header-scroll-view';
export default class imageScroll extends Component {
render() {
return (
<HeaderImageScrollView
maxHeight={200}
minHeight={58}
renderFixedForeground={() => {
return(
<View style={styles.header}>
<Button title="TEST" onPress={() => console.log('tap!!')}/>
</View>)
}}
renderHeader={() => (
<Image source={require('./photo.jpg')} style={styles.image} />
)}
>
<View style={{ height: 1000 }}>
<TriggeringView onHide={() => console.log('text hidden')} >
<Text>Scroll Me!</Text>
</TriggeringView>
</View>
</HeaderImageScrollView>
);
}
}
const styles = StyleSheet.create({
header :{
flex: 1,
height: 56,
padding: 10,
position: 'absolute',
top: 0,
left: 0,
right: 0,
justifyContent: 'center',
}
});
AppRegistry.registerComponent('imageScroll', () => imageScroll);
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
React Native pass and get params in two class components
I am getting this error and I can't find out why. I am looking for the answer since hours ...
Read more >How To Make A Nested Carousel In A Flatlist That Display ...
Animate elements as they scroll into view. Handsontable Community Edition - A ... onPress within renderFixedForeground() not working for me.
Read more >Need Help React Native Image Header Scroll View...anycodings
Cannot reproduce angular project environment from stackblitz example ... How to increase the click area of ​the element without changing ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Unfortunately no. Still have no solution for this 😕
I tried to work on that issue today, but with no success. I guess I need help to find a solution.
The following schemas represent the current implementation of the module after a small scroll.
The legend :
transformYto be able to see the image behind.As you see, the scrollVIew is above the header and the fixed foreground. That’s why we can’t press on it. The scrollView take the event from the Responder system.
If you want to see the code with the color : #21
In the previous implementation, the header was above the scrollView (same legend)
I reduce the height of the header container (in red) on scroll. The header container have an
overflow: hidden. The image and the fixed foreground are placed with absolute positioning inside and are cropped when the container height reduce (like you suggested @tychota) The code is here : #20 (with the colors: #19)Everything stay touchable but it is very laggy. I guess it is related to the image rerendering or too much time between the ScrollView event.
@tychota @Almouro @yleflour @4ian Anyone of you have an Idea on what I can do ?