Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Element drop shadow / blur #176

Closed
julesmoretti opened this issue Nov 11, 2016 · 9 comments
Closed

Element drop shadow / blur #176

julesmoretti opened this issue Nov 11, 2016 · 9 comments

Comments

@julesmoretti
Copy link

Hello Everyone:

Having a drop shadows and blurs would be really really appreciated :)

@brentvatne @chengyin @MoOx @mattapperson @gorangajic

Thank you.

Jules

@mattapperson
Copy link

Could you explain your request a little more?

@MoOx
Copy link
Contributor

MoOx commented Nov 11, 2016

Can you stop poking me? I don't understand why you poke me as I never really used this module.

@mattapperson
Copy link

@MoOx he is poking every contributor...

@MoOx
Copy link
Contributor

MoOx commented Nov 11, 2016

According to this https://github.com/react-native-community/react-native-svg/graphs/contributors I am not really a contributor... Anyway, this is not a good idea :)

@mattapperson
Copy link

hahah yea, but I was just playing captain obvious :)

@chengyin
Copy link

Please stop at people unless for direct reasons. Don't mass spam the contributors for feature requests, or your bug reports. This is a common courtesy.

@julesmoretti
Copy link
Author

@MoOx I poke every contributors to modules that are not very responsive in getting back to issues. I work at a large product company now and we would love this module to work efficiently for our future pipline's ;)...

Therefore,

@mattapperson Currently the SVG module does not offer any form of drop shadow integretion (feGaussianBlur) nor things like transform-origin (which is another issue but hey...). So it would be great if an element like a Rect, Circle, Path and so on... could have a drop shadow with the ability to set and x y offset, drop shadow color, drop shadow opacity, drop shadow radius and so on... and ideally have the feGaussianBlur integration too in order to blur the entire svg Polypath.

@chengyin - I would love to, but then please suggest a more efficient methodology to getting solutions/responses quicker ;)

Cheers all!

@mattapperson
Copy link

mattapperson commented Nov 12, 2016

@julesmoretti While we find it EXTREMELY cool that a company like Frog Design would want to use this project... please keep in mind that we contributors help maintain this project for free. Typically features are added when someone needs it that has the ability to add the feature and they then submit a pull request, not just on-demand when users ask.
If however you need faster response times, or particular features added quickly, those of us that own agencies such as myself are more then happy to offer paid support and SLAs on these and other modules that would give you the level of support and response times you seem to need. If that interests you, please feel free to reach out to me via email at [email protected].

@msand
Copy link
Collaborator

msand commented Dec 9, 2018

Work on filters tracked here: #150

@msand msand closed this as completed Dec 9, 2018
jakex7 added a commit that referenced this issue Jul 11, 2024
# Summary

Introducing the long-awaited **Filters** in `react-native-svg` 🎉

### Motivation

This PR is the beginning of bringing support of SVG Filters into
`react-native-svg`.

* **related issues**: This PR series will address the following issues:
#150, #176, #635, #883, #994, #996, #1216
* **feature overview**: This PR is a boilerplate for Filters
   * introducing `Filter` component and `FeColorMatrix` as a start. 
* It also introduces a new subdirectory called
`react-native-svg/filter-image` with a `FilterImage` component.

# Usage

## Filter and Fe...

Filters are compatible with the web familiar standard, so most things
should be compatible out-of-the-box and changes will be limited to using
a capital letter as it's component.

### Example

```tsx
import React from 'react';
import { FeColorMatrix, Filter, Rect, Svg } from 'react-native-svg';

export default () => {
  return (
    <Svg height="300" width="300">
      <Filter id="myFilter">
        <FeColorMatrix type="saturate" values="0.2" />
      </Filter>
      <Rect
        x="0"
        y="0"
        width="300"
        height="300"
        fill="red"
        filter="url(#myFilter)"
      />
    </Svg>
  );
};
```

![image](https://github.com/software-mansion/react-native-svg/assets/39670088/c36fb238-95f4-455d-b0aa-2a7d4038b828)

## Filter Image

`FilterImage` is a new component that is not strictly related to SVG.
Its behavior should be the same as a regular `Image` component from
React Native with one exception - the additional prop `filters`, which
accepts an array of filters to apply to the image.

### Example

```tsx
import React from 'react';
import { StyleSheet } from 'react-native';
import { FilterImage } from 'react-native-svg/filter-image';

const myImage = require('./myImage.jpg');

export default () => {
  return (
    <FilterImage
      style={styles.image}
      source={myImage}
      filters={[
        { name: 'colorMatrix', type: 'saturate', values: 0.2 },
        {
          name: 'colorMatrix',
          type: 'matrix',
          values: [
            0.2, 0.2, 0.2, 0, 0, 0.2, 0.2, 0.2, 0, 0, 0.2, 0.2, 0.2, 0, 0, 0, 0,
            0, 1, 0,
          ],
        },
      ]}
    />
  );
};
const styles = StyleSheet.create({
  image: {
    width: 200,
    height: 200,
  },
});
```


![image](https://github.com/software-mansion/react-native-svg/assets/39670088/666ed89f-68d8-491b-b97f-1eef112b7095)

## Test Plan

**Example App**: Updated the example app with various filter effects,
showcasing real-world usage.

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |    ✅     |
| Android |    ✅     |

## Checklist

- [x] I have tested this on a device and a simulator
- [x] I added documentation in `README.md` and `USAGE.md`
- [x] I updated the typed files (typescript)
@jakex7 jakex7 mentioned this issue Jul 23, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants