[英]How can I include a ScrollView inside a Touchable component?
I have a main View
component containing a ScrollView
image carousel and another View
that includes some Text
component. 我有一个包含
ScrollView
图像轮播的主View
组件和另一个包含一些Text
组件的View
。 I want to touch over the main View
and open another app view, but I need to scroll images too. 我想触摸主
View
并打开另一个应用程序视图,但我也需要滚动图像。
I tried to put the main View
inside a TouchableOpacity
(I tried TouchableHighlight
and TouchableWithoutFeedback
too) and it doesn't work fine. 我试图把主
View
放在一个TouchableOpacity
里面(我也试过TouchableHighlight
和TouchableWithoutFeedback
)并且它不能正常工作。
The following code is how I am trying to solve it: 以下代码是我试图解决它的方式:
<TouchableOpacity onPress={this.showView}>
<View style={styles.mainContainer}>
<ScrollView horizontal pagingEnabled>
{images.map((image, index) => (
<Image
key={index}
source={image}
/>
))}
</ScrollView>
<View style={styles.title}>
<View style={styles.rowContainer}>
<Text>{sample text}</Text>
</View>
</View>
</View>
</TouchableOpacity>
Any idea? 任何想法?
Thanks in advance 提前致谢
我认为应用于此主View
PanResponder可能适合您,而不是将View包装在任何Touchable{...}
组件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.