mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 22:05:14 +00:00
Implement support for em in dx and dy attributes and font props for G element
This commit is contained in:
@@ -47,7 +47,7 @@ function parseFontString(font) {
|
||||
return cachedFontObjectsFromString[font];
|
||||
}
|
||||
|
||||
function extractFont(props) {
|
||||
export function extractFont(props) {
|
||||
let font = props.font;
|
||||
let fontSize = +props.fontSize;
|
||||
|
||||
@@ -68,8 +68,11 @@ function extractFont(props) {
|
||||
|
||||
function parseDelta(delta) {
|
||||
if (typeof delta === 'string') {
|
||||
if (isNaN(+delta)) {
|
||||
return delta.trim().replace(commaReg, ' ').split(spaceReg).map(d => +d || 0);
|
||||
const trim = delta.trim();
|
||||
if (trim.slice(-2) === 'em') {
|
||||
return [trim];
|
||||
} else if (isNaN(+delta)) {
|
||||
return trim.replace(commaReg, ' ').split(spaceReg).map(d => +d || 0);
|
||||
} else {
|
||||
return [+delta];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user