提问人:Andain 提问时间:2/12/2023 更新时间:2/12/2023 访问量:78
如何使 FlatList 顶部的绝对定位可触摸元素仅捕获新闻事件并让其他事件传播到 FlatList?
How do I make an absolut positioned touchable element on top of a FlatList catch only press events and let other events propagate to the FlatList?
问:
我在React Native中有一个全屏图像和视频项目(带有)。我想在顶部浮动一个简短的描述性可触摸文本,以便在按下时打开一个视图,其中包含有关图像/视频的一些信息。FlatList
pagingEnabled
FlatList
为了使用户体验更好,我也希望能够滚动浏览可触摸的文本。即,如果用户碰巧在文本顶部开始滚动运动,则会滚动,但如果是一个简单的新闻事件,我想打开包含有关图像/视频的详细信息的视图。FlatList
FlatList
无论我尝试什么,我最终要么文本能够对新闻做出反应,要么能够滚动。我尝试了不同的自定义配置,但似乎总是以一种状态结束,因为一件事不起作用。你们有什么聪明的想法吗?我可能只是陷入了错误的思路。FlatList
PanResponder
pointerEvents
这是我的组件结构的简化视图:
<View>
<View style={{ position: 'absolute', bottom: 100, zIndex: 10 }}>
<TouchableOpacity onPress={() => console.log('press')}>
<Text>Some Descriptive Text</Text>
</TouchableOpacity>
</View>
<FlatList pagingEnabled horizontal {...otherFlatListProps} />
</View>
答: 暂无答案
评论