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

LinearGradient prop - not a valid number or percentage string #9

Open
moritzkarliczek opened this issue Nov 16, 2022 · 0 comments
Open

Comments

@moritzkarliczek
Copy link

The value of the offset property needs to be parsed to a number or a valid percentage string. In this example offset=".05" needs to be parsed to offset={0.05}.

At the moment i get a warning:

WARN ".05" is not a valid number or percentage string.

Example SVG:

  ...
    <linearGradient id="myGradient" gradientTransform="rotate(90)">
      <stop offset=".05" stop-color="gold" />
      <stop offset=".95" stop-color="red" />
    </linearGradient>
...

it beeing converted to:

...
<LinearGradient id="test_svg__a" gradientTransform="rotate(90)">
          <Stop offset=".05" stopColor="gold" />
          <Stop offset=".95" stopColor="red" />
</LinearGradient>
...

what would be correct: (which is what SVGR is doing)

...
<LinearGradient id="test_svg__a" gradientTransform="rotate(90)">
          <Stop offset={0.05} stopColor="gold" />
          <Stop offset={0.95} stopColor="red" />
</LinearGradient>
...
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

1 participant