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

Warning: React does not recognize the maskType prop on a DOM element. #111

Open
mateuscdomingos opened this issue Aug 10, 2021 · 3 comments

Comments

@mateuscdomingos
Copy link

When the lib transforms to SVG, it adds the maskType property and so I get the following error:

Warning: React does not recognize the maskType prop on a DOM element.

I need to change maskType to mask-type but I don't know how I can do it.

<mask id="a" maskType="alpha" maskUnits="userSpaceOnUse" x="1" y="1" width="14" height="14">

@ljharb
Copy link
Collaborator

ljharb commented Aug 10, 2021

This is something svgo is doing, so you'd need to configure it with svgo options. Off the top of my head, I'm not sure what those would be.

@mateuscdomingos
Copy link
Author

mateuscdomingos commented Aug 11, 2021

Hi, @ljharb!

I opened an issue there in the SVGO repository, they recommended me to write this plugin:

const renameMaskType = {
  name: 'renameMaskType',
  type: 'visitor',
  fn: () => {
    return {
      element: {
        enter: node => {
          node.attributes['mask-type'] = node.attributes.maskType
          delete node.attributes.maskType
        }
      }
    }
  }
}

If I create the svgo.config.js file, it doesn't work. Do you know how I can configure it?

@brada1703
Copy link

I'm also experiencing this issue. @MateusCastro , did you find a solution?

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

3 participants