mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 07:25:53 +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 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 baseCssAdapter from 'css-select-base-adapter';
|
||||||
import csstree, { List } from 'css-tree';
|
import csstree, { List } from 'css-tree';
|
||||||
import cssSelect from 'css-select';
|
import cssSelect from 'css-select';
|
||||||
@@ -563,7 +563,7 @@ CSSStyleDeclaration.prototype.setProperty = function(
|
|||||||
};
|
};
|
||||||
let key = propertyName.trim();
|
let key = propertyName.trim();
|
||||||
properties.set(key, property);
|
properties.set(key, property);
|
||||||
this.parentNode.props.style[key] = trimmedValue;
|
this.parentNode.props.style[camelCase(key)] = trimmedValue;
|
||||||
|
|
||||||
return property;
|
return property;
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -174,7 +174,7 @@ export class SvgFromUri extends Component<UriProps, UriState> {
|
|||||||
|
|
||||||
const upperCase = (_match: string, letter: string) => letter.toUpperCase();
|
const upperCase = (_match: string, letter: string) => letter.toUpperCase();
|
||||||
|
|
||||||
const camelCase = (phrase: string) =>
|
export const camelCase = (phrase: string) =>
|
||||||
phrase.replace(/[:\-]([a-z])/g, upperCase);
|
phrase.replace(/[:\-]([a-z])/g, upperCase);
|
||||||
|
|
||||||
type Styles = { [property: string]: string };
|
type Styles = { [property: string]: string };
|
||||||
|
|||||||
Reference in New Issue
Block a user