mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-03 23:16:13 +00:00
fix: camelCase css from style elements
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { parse, SvgAst } from './xml';
|
||||
import { camelCase, parse, SvgAst } from './xml';
|
||||
import baseCssAdapter from 'css-select-base-adapter';
|
||||
import csstree, { List } from 'css-tree';
|
||||
import cssSelect from 'css-select';
|
||||
@@ -563,7 +563,7 @@ CSSStyleDeclaration.prototype.setProperty = function(
|
||||
};
|
||||
let key = propertyName.trim();
|
||||
properties.set(key, property);
|
||||
this.parentNode.props.style[key] = trimmedValue;
|
||||
this.parentNode.props.style[camelCase(key)] = trimmedValue;
|
||||
|
||||
return property;
|
||||
};
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ export class SvgFromUri extends Component<UriProps, UriState> {
|
||||
|
||||
const upperCase = (_match: string, letter: string) => letter.toUpperCase();
|
||||
|
||||
const camelCase = (phrase: string) =>
|
||||
export const camelCase = (phrase: string) =>
|
||||
phrase.replace(/[:\-]([a-z])/g, upperCase);
|
||||
|
||||
type Styles = { [property: string]: string };
|
||||
|
||||
Reference in New Issue
Block a user