【发布时间】:2018-10-05 10:05:04
【问题描述】:
我正在渲染平面列表,我根据索引渲染了一些图像。
所以它看起来像这样:https://ibb.co/ep2zye
我正在像这样渲染平面列表的左侧:
if(index % 2 == 0){
return {
marginTop: -SCREEN_WIDTH/12 + -(index-2)*SCREEN_WIDTH/20,
marginRight: SCREEN_WIDTH / 35,
marginLeft: SCREEN_WIDTH / 35,
margin: SCREEN_WIDTH / 50,
width: this.width,
height: this.height,
opacity: this.state.opacity,
borderRadius: SCREEN_WIDTH / 36,
}
}
渲染看起来像这样:
return (
<Animated.View pointerEvents={this.state.pointer}>
<TouchableOpacity onPress={this.captureAnimation.bind(this, item, index)} style={{backgroundColor: 'darkred'}}>
<AnimatedImage source={{uri: 'http://' + item.info.picture_path}} style={this.renderStyle(index)}/>
<View style={{position: 'absolute', bottom: SCREEN_WIDTH/20, left: SCREEN_WIDTH/24, width: '80%'}}>
<Text style={{fontSize: SCREEN_WIDTH / 27, color: '#ffffff',fontWeight: 'bold'}}>{item.info.title} </Text>
<Text style={{fontSize: SCREEN_WIDTH / 42, color: '#ffffff',fontWeight: 'bold'}}> {item.date} </Text>
</View>
</TouchableOpacity>
</Animated.View>
);
所以我不明白为什么,可触摸的不透明度没有包裹所有图像,而不是包裹其中的一部分?即使我做marginTop,touchableopacity应该是包装它不是吗?谁能告诉我这里出了什么问题?
【问题讨论】:
-
setOpacityTo - stackoverflow.com/questions/47318861/…
-
不,我并不是说动画。我的问题是,如果它一直包裹着想象,为什么 touchableopacity 区域会变小?
-
+++ 没有 cmets?没有解决办法?
标签: css react-native