简体   繁体   English

ReactNative 使图像与背景淡入

[英]ReactNative make image to fade in with background

I am trying to achieve Image on background to fade in with background color.我正在尝试实现背景上的图像以背景颜色淡入。 Basically I have image on background for half screen but bottom border is kind of sharp I want to make image transition to background smooth.基本上我在背景上有半屏图像,但底部边框有点锐利,我想让图像过渡到背景平滑。 Any suggestions?有什么建议么? Something like this: Image example像这样的东西:图像示例

I found the solution, I need to put linear gradient on top of image from transparent to bottom color我找到了解决方案,我需要在图像顶部放置从透明到底部颜色的线性渐变

  <Image
    style={styles.absolute}
    source={{ uri: drink.imageUrl }}
    blurRadius={20}
  />
  <LinearGradient
    colors={['transparent', 'rgba(255,255,255,1)']}
    style={styles.absolute}
  />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM