Is there a way to interact with other component in MapPanel example?
See original GitHub issueI am amazed by this library but I kinda have a problem integrating with my other components.
In the photo above, I have a button where width and height are equal to screen prop. I am unable to interact with it unless I mess with zIndex. Have tried to dynamically change the zIndex but it is not really the best usage.
Is there a way where we can both interact with whatever components that I have behind the Interactable
view, and at the same time, have full control over the Interactable
view?
onPanelDrag = ({ y }) => {
console.log(y);
if (y === 492) {
this.setState({ buttonIndex: -99 });
} else if (y === 292) {
this.setState({ buttonIndex: 0 });
}
};
render() {
return (
<View style={styles.container}>
<TouchableOpacity
style={[
{
width: Screen.width,
height: Screen.height,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: "blue",
zIndex: this.state.buttonIndex
}
]}
onPress={() => console.log(this.panel.props.snapPoints)}
>
<Text style={{ fontSize: 20, color: '#fff' }}>Reset</Text>
</TouchableOpacity>
<View style={[styles.panelContainer]}>
<Animated.View
style={[
styles.panelContainer,
{
backgroundColor: "black",
opacity: this._deltaY.interpolate({
inputRange: [0, Screen.height - 100],
outputRange: [0.5, 0],
extrapolateRight: "clamp"
})
}
]}
/>
<Interactable.View
ref={ref => {
this.panel = ref;
}}
verticalOnly={true}
snapPoints={[
{ y: Screen.height - 300 },
{ y: Screen.height - 100 }
]}
boundaries={{ top: -300 }}
initialPosition={{ y: Screen.height - 100 }}
onDrag={event => this.onPanelDrag(event.nativeEvent)}
animatedValueY={this._deltaY}
>
<View style={[styles.panel]}>
<View style={styles.panelHeader}>
<View style={styles.panelHandle} />
</View>
<Text style={styles.panelTitle}>San Francisco Airport</Text>
<Text style={styles.panelSubtitle}>
International Airport - 40 miles away
</Text>
<View style={styles.panelButton}>
<Text style={styles.panelButtonTitle}>Directions</Text>
</View>
<View style={styles.panelButton}>
<Text style={styles.panelButtonTitle}>Search Nearby</Text>
</View>
<Image
style={styles.photo}
source={require("../img/airport-photo.jpg")}
/>
</View>
</Interactable.View>
</View>
</View>
);
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:6
Top Results From Across the Web
How can I communicate between related react components?
If you want to see an example of the same little app using these different styles, check the branches of this repository. I...
Read more >25 Using Map Components - Oracle Help Center
This chapter describes how to display data in geographic and thematic maps using ADF Faces ... Move data markers from one location to...
Read more >Mapping Components in React
We've already covered the hardcoding of components in React, when you already know exactly what you want to show up on the screen....
Read more >Build a Google Maps style panel overlay with scrollable inner ...
I will only go over how to implement the <MapPanel> component in this article. For right now, the <MapPanel> component will have a...
Read more >Creating a Graphical User Interface with Google Earth Engine
4.1 RMET Components; 4.2 Experiment with the Interface; 4.3 The Logic Behind ... with simplified examples to provide a conceptual understanding of how...
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
@lebovic ah it does not work for me. Now my panel is gone 😦 Can you check where did I do wrong?
@rexlow I think you could try to add
pointerEvents='box-none'
to panel container view, like this<View style={[styles.panelContainer]} pointerEvents='box-none'>
, so the container view will never the target of touch events but it’s subviews can be. FYI https://facebook.github.io/react-native/docs/view.html#pointerevents