How to have a transparent gradient over an Image in React Native iOS?

前端 未结 3 629
梦如初夏
梦如初夏 2021-02-13 07:02

I have been dealing with the a gradient rectangle over an Image that has a black and a transparent sides, I have been looking about a gradient object in react native and I didn\

3条回答
  •  情深已故
    2021-02-13 07:48

    Try positioning LinearGradient absolute adding style to LinearGradient

      this.image = r}  style={styles.container} 
            source={require('../assets/default_profile_picture.jpg')}>
           this.gradiant = r} locations={[0, 1.0]}  colors= 
                        {['rgba(0,0,0,0.00)', 'rgba(0,0,0,0.80)']} 
                        style={styles.linearGradient}>
          
     
    


    styles.linearGradient = {
     ...,
     position:'absolute',
     width:'100%',
     height:'100%'
    }
    

提交回复
热议问题