software-mansion / react-native-svg

SVG library for React Native, React Native Web, and plain React web projects.
MIT License
7.37k stars 1.11k forks source link

Masked component is loosing precision, get pixelated #2057

Open injecteer opened 1 year ago

injecteer commented 1 year ago

In my app I have this code:

<Svg width={W} height={H} viewBox="0 0 150 100" preserveAspectRatio="none">
  <Defs>
    <Mask id="mask" x={0} y={0} width={W} height={H} maskUnits="userSpaceOnUse">
      <Nested name="Path" d={path} animated stroke="white" fill="none" strokeLinejoin="round" strokeWidth={10} />
    </Mask>
  </Defs>

  <G mask="url(#mask)">
    <Path d={path} stroke="orange" strokeLinejoin="round" fill="none"/>
    {fields.map( f => <Nested key={f.id} {...f}/>)}
  </G>

  <G transform="translate(0 -20)">
    <Path d={path} stroke="orange" strokeLinejoin="round" fill="none"/>
    {fields.map( f => <Nested key={f.id} {...f}/>)}
  </G>
</Svg>

where Nested is a delegation to Path, Circle and other RN-SVG elements.

Bug

The G with mask (at the bottom) looks like so in the emulator or on real device:

image

in web-mode both Gs look crisp:

image

Further info with screenshots see on Stackoverflow: https://stackoverflow.com/questions/76264610/react-native-svg-masked-elements-pixelated-in-android-emulator

Library version: 13.4.0

Steps To Reproduce

See the snack https://snack.expo.dev/@injecteer/react-native-svg-mask

injecteer commented 1 year ago

Any reaction to this?

Because of the bug the Mask is not usable at all!