在react-native中使用CSS过滤器

Vit*_*lyB 5 react-native

看来react-native并没有实现CSS的filter属性。

有没有办法复制那些?具体来说,我正在寻找一种将以下内容更改为图像的方法,而无需为此专门创建特殊图像:

  • 亮度
  • 色调
  • 饱和
  • 模糊

iye*_*off 2

RN 已经通过BlurRadius属性支持图像模糊。您可以在我的react-native-color-matrix-image-filters库中找到其余的过滤器:

import { Image } from 'react-native';
import { Saturate } from 'react-native-color-matrix-image-filters';

const SaturatedImage = ({ saturate, ...imageProps }) => (
  <Saturate value={saturate}>
    <Image {...imageProps} />
  </Saturate>
);
Run Code Online (Sandbox Code Playgroud)