You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am migrating away from a react icon-library and I am trying to align the API of our icon-components which we generate with SVGR all the while trying to provide a almost identical API for the icon as used in the mentioned library.
Now I have the issue, that I'd like to always have the verticalAlign: "middle" style set, even when a custom style object is being passed. There for I set the following value for the svgProps.style {{ verticalAlign: "middle", ...props.style }}
As you can see in the snippet of my SVGR-config below, I am attempting to merge the style object passed from the props. Unfortunately, that doesn't seem to be working, as I get the following error while running svgr-cli:
: TypeError: Cannot assign to read only property 'message' of object 'SyntaxError: Unexpected token (2:27)
@org/icons:build: 1 | /* @babel/template */;
@org/icons:build: > 2 | { verticalAlign: "middle", ...props.style }
Based on this error I assume that the spread-operator is not allowed.
Is there any specific reason for this behaviour?
I find it rather limiting.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am migrating away from a react icon-library and I am trying to align the API of our icon-components which we generate with SVGR all the while trying to provide a almost identical API for the icon as used in the mentioned library.
Now I have the issue, that I'd like to always have the
verticalAlign: "middle"
style set, even when a custom style object is being passed. There for I set the following value for the svgProps.style{{ verticalAlign: "middle", ...props.style }}
As you can see in the snippet of my SVGR-config below, I am attempting to merge the style object passed from the props. Unfortunately, that doesn't seem to be working, as I get the following error while running svgr-cli:
Based on this error I assume that the spread-operator is not allowed.
Is there any specific reason for this behaviour?
I find it rather limiting.
Below you can see a partial of my SVGR-config.
Beta Was this translation helpful? Give feedback.
All reactions