question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Low quality of mask, iOS

See original GitHub issue

Hello. I just tryed to apply circle stroke mask.

Android 8 draws it perfectly like something vector. But iOS draws it low quality:

image (Screenshot from iOS)

import { Svg, Defs, Rect, Circle, LinearGradient, Stop, G, Mask, Use } from 'react-native-svg';

const STOP_COLOR = 'red';

class Keck extends PureComponent {
    render() {
        const { rotation } = this.props;
        const innerDefs = [
            // bottom left rectangle
            { x: 0, y: 60, start: 0.9, end: 1 },
            // top left rectangle
            { x: 0, y: 0, start: 0.9, end: 0.75 },
            // top right rectangle
            { x: 60, y: 0, start: 0.75, end: 0.3 },
            // bottom right rectangle
            { x: 60, y: 60, start: 0, end: 0.5 },
        ];
        return (
            <Svg height="120" width="120" fill="transparent">
                <Defs>
                    <Mask id="mask"
                        x="0"
                        y="0"
                        width={120}
                        height={120}
                        maskUnits="userSpaceOnUse"
                    >
                        <Circle
                            r={42}
                            cx={60}
                            cy={60}
                            stroke="white"
                            strokeWidth={6}
                            strokeDasharray="1 4.5"
                        />
                    </Mask>
                </Defs>
                <G mask="url(#mask)">
                    <G rotation={rotation} origin="60, 60">
                        <OpticalGradient definitions={innerDefs} />
                    </G>
                </G>
            </Svg>
        );
    }
}

Why does it happens? Looks like something about 1x, 2x, 3x dpi… but I don’t get it where props about resolution…

PS: I don’t show you <OpticalGradient ... /> because it’s simple gradients rectangles which works fine. But mask of dotted circle is very ugly on iOS. If I use <Circle … /> without mask – it renders well, but I need to rotate gradient only inside Circle strokes.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:12

github_iconTop GitHub Comments

1reaction
zmnvcommented, Sep 16, 2019

I can’t use style={{transform: [{scale: TRANSFORM_RESOLUTION}]}} because it will drop fps with animation.

0reactions
cesargdmcommented, Aug 26, 2021

Still facing the issue even with the svg width="100%" suggestion Simulator Screen Shot - iPhone 12 mini - 2021-08-26 at 11 21 04

Read more comments on GitHub >

github_iconTop Results From Across the Web

Low quality of mask, iOS · Issue #1098 - GitHub
Hello. I just tryed to apply circle stroke mask. Android 8 draws it perfectly like something vector. But iOS draws it low quality:...
Read more >
Low quality of capture view context on iPad - Stack Overflow
I need capture specific UIView , but the result is in low quality how can fix this and increase the quality ? UIGraphicsBeginImageContext( ......
Read more >
Face ID With a Mask: How It Works and What You Need to Know
Face ID when wearing a mask works just like Face ID without a mask. You swipe up on the ‌iPhone‌'s display and it...
Read more >
VisionKit | Apple Developer Forums
Hey guys, facing the issue that scanned documents on my iPhone 12 Pro Max with Files app are pretty bad quality. Guess it...
Read more >
Apple Is Working On Face ID With Masks Feature; Bad News ...
In the newest developer beta of its iOS 15.4 patch, Apple is testing the "Face ID with mask" functionality. By Mashable News Staff...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found