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

Pixelated SVG on Android when using SvgXml and applying style scale transform. #2179

Open
israelcrux opened this issue Nov 27, 2023 · 2 comments
Assignees
Labels

Comments

@israelcrux
Copy link

Bug

SVGs displayed using SvgXML are pixelated on Android when scaled using style transforms.

Conditions to reproduce:

  • Use SvgXML
  • Apply a style transformation on scale different to 1 (does not matter if less or more)
  • Run on Android.

The following component:

import * as React from 'react';
import { SvgXml } from 'react-native-svg';

export const LogoSVG: React.FC = () => {
  const svgXML = `<svg width="20" height="20" viewBox="0 0 40 40" fill="none">
    <circle cx="20" cy="20" r="10" fill="#FF0000"/>
  </svg>`;
  return <SvgXml xml={svgXML} style={{ transform: [{ scale: 2.5 }] }} />;
};

Renders like this:
Screenshot 2023-11-26 at 21 08 10

In contrast, when no scale transformation is applied (scale = 1);

import * as React from 'react';
import { SvgXml } from 'react-native-svg';

export const LogoSVG: React.FC = () => {
  const svgXML = `<svg width="60" height="60" viewBox="0 0 40 40" fill="none">
    <circle cx="20" cy="20" r="10" fill="#FF0000"/>
  </svg>`;
  return <SvgXml xml={svgXML} style={{ transform: [{ scale: 1 }] }} />;
};

It renders a sharp, geometrically precise figure:
Screenshot 2023-11-26 at 21 13 42

@csath
Copy link

csath commented Dec 4, 2023

I'm also getting this issue on Android. I tried using react-native-svg 14.0.0, 13.14.0, 13.13.0 with RN 0.72.6. Still getting this issue. Any workaround or fix?

Seems the same issue mentioned in
#1885 (comment)

@welschmoor
Copy link

same here

@bohdanprog bohdanprog added the bug label Jun 12, 2024
@jakex7 jakex7 self-assigned this Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants