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

前端 未结 3 2231
刺人心
刺人心 2021-02-13 07:29

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:51

    You can use my react-native-image-filter-kit library to achieve this:

    import { Image } from 'react-native'
    import {
      SrcOverComposition,
      LinearGradient
    } from 'react-native-image-filter-kit'
    
    const masked = (
      
        }
        srcResizeMode={{ width: 1, height: 0.5 }}
        srcAnchor={{ y: 0 }}
        srcImage={
          
        }
      />
    )
    

    Android:

    iOS:

提交回复
热议问题