Skip to content

Commit f157d72

Browse files
authored
Fix how we handle style in our Svg image component for web (#2612)
* Fix how we handle style in our Svg image component for web * fix how we clone style object
1 parent 43bbd33 commit f157d72

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/components/svgImage/index.web.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ export interface SvgImageProps {
1414
}
1515

1616
function SvgImage(props: SvgImageProps) {
17-
const {data, style, tintColor, ...others} = props;
18-
19-
const styleObj = Object.assign({}, ...(style || []));
20-
17+
const {data, style = {}, tintColor, ...others} = props;
2118
const [svgStyleCss, setSvgStyleCss] = useState<string>(EMPTY_STYLE);
2219
const [postCssStyleCalled, setPostCssStyleCalled] = useState(false);
2320

21+
const styleObj = JSON.parse(JSON.stringify(style));
22+
2423
const createStyleSvgCss = async (PostCssPackage: {postcss: any; cssjs: any}) => {
2524
setPostCssStyleCalled(true);
2625
const {postcss, cssjs} = PostCssPackage;

0 commit comments

Comments
 (0)