You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When displaying an SVG that contains a filter, the svg is not displayed when using v15.4.0. It works fine in v15.3.0. The issue only occurs on iOS, Android is fine.
Steps to reproduce
Add the following code/files:
App.ts:
import React from 'react';
import {SafeAreaView, Text} from 'react-native';
import SvgNoFilter from './user-location-dot-no-filter.svg';
import SvgFilter from './user-location-dot.svg';
function App(): React.JSX.Element {
return (
<SafeAreaView>
<Text>SVG without filter</Text>
<SvgNoFilter />
<Text>SVG with filter</Text>
<SvgFilter />
</SafeAreaView>
);
}
export default App;
Hi @fikkatra,
thank you for reporting that. react-native-svg-transformer transforms your file into this (V) stripping out filters, however leaving filter prop with non-existing URL. I've created the fix for that and will post it soon.
# Summary
Closes#2356
Currently, when `filter` prop is defined, but there is no equivalent
`<Filter>` component, on iOS nothing is rendered, with this fix this
prop would be ignored, and the component should render as expected.
## Test Plan
```tsx
<Svg width="400" height="400" viewBox="0 0 124 124" fill="none">
<Rect width="124" height="124" rx="24" fill="red" filter="url(#nonExistingFilterId)"/>
</Svg>
```
## Affected platforms
| OS | Implemented |
| ------- | :---------: |
| iOS | ✅ |
This issue also appears to affect Safari, and the issue with Safari is still present in 15.9.0. Going into the element inspector and removing the filter=blahblah makes the SVG show up. Should I open a new bug report for this?
Description
When displaying an SVG that contains a filter, the svg is not displayed when using v15.4.0. It works fine in v15.3.0. The issue only occurs on iOS, Android is fine.
Steps to reproduce
Add the following code/files:
App.ts:
user-location-dot-no-filter.svg:
user-location-dot.svg:
Result:
Now revert back to v15.3.0:
Result:
Snack or a link to a repository
https://github.com/fikkatra/react-native-svg-with-filters
SVG version
15.4.0
React Native version
0.74.3
Platforms
iOS
JavaScript runtime
None
Workflow
React Native
Architecture
None
Build type
Debug app & dev bundle
Device
iOS simulator
Device model
iPhone 15 Pro, iOS 17.5
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: