mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-07 00:42:31 +00:00
Organize imports. (ios) Fix numeric font size handling.
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
import Shape from "./Shape";
|
|
||||||
import extractProps from "../lib/extract/extractProps";
|
import extractProps from "../lib/extract/extractProps";
|
||||||
|
import Shape from "./Shape";
|
||||||
|
|
||||||
export default class extends Shape {
|
export default class extends Shape {
|
||||||
static displayName = "Circle";
|
static displayName = "Circle";
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
import Shape from "./Shape";
|
|
||||||
import extractProps from "../lib/extract/extractProps";
|
import extractProps from "../lib/extract/extractProps";
|
||||||
|
import Shape from "./Shape";
|
||||||
|
|
||||||
export default class extends Shape {
|
export default class extends Shape {
|
||||||
static displayName = "Ellipse";
|
static displayName = "Ellipse";
|
||||||
|
|||||||
+1
-1
@@ -1,9 +1,9 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
import Shape from "./Shape";
|
|
||||||
import extractProps from "../lib/extract/extractProps";
|
import extractProps from "../lib/extract/extractProps";
|
||||||
import { extractFont } from "../lib/extract/extractText";
|
import { extractFont } from "../lib/extract/extractText";
|
||||||
import extractTransform from "../lib/extract/extractTransform";
|
import extractTransform from "../lib/extract/extractTransform";
|
||||||
|
import Shape from "./Shape";
|
||||||
|
|
||||||
export default class extends Shape {
|
export default class extends Shape {
|
||||||
static displayName = "G";
|
static displayName = "G";
|
||||||
|
|||||||
+1
-1
@@ -1,8 +1,8 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Image, requireNativeComponent } from "react-native";
|
import { Image, requireNativeComponent } from "react-native";
|
||||||
import Shape from "./Shape";
|
|
||||||
import { meetOrSliceTypes, alignEnum } from "../lib/extract/extractViewBox";
|
import { meetOrSliceTypes, alignEnum } from "../lib/extract/extractViewBox";
|
||||||
import extractProps from "../lib/extract/extractProps";
|
import extractProps from "../lib/extract/extractProps";
|
||||||
|
import Shape from "./Shape";
|
||||||
|
|
||||||
const spacesRegExp = /\s+/;
|
const spacesRegExp = /\s+/;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
import Shape from "./Shape";
|
|
||||||
import extractProps from "../lib/extract/extractProps";
|
import extractProps from "../lib/extract/extractProps";
|
||||||
|
import Shape from "./Shape";
|
||||||
|
|
||||||
export default class extends Shape {
|
export default class extends Shape {
|
||||||
static displayName = "Line";
|
static displayName = "Line";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import extractGradient from "../lib/extract/extractGradient";
|
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
|
import extractGradient from "../lib/extract/extractGradient";
|
||||||
|
|
||||||
export default class extends Component {
|
export default class extends Component {
|
||||||
static displayName = "LinearGradient";
|
static displayName = "LinearGradient";
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
import units from "../lib/units";
|
|
||||||
import extractTransform from "../lib/extract/extractTransform";
|
import extractTransform from "../lib/extract/extractTransform";
|
||||||
|
import units from "../lib/units";
|
||||||
|
|
||||||
export default class extends Component {
|
export default class extends Component {
|
||||||
static displayName = "Mask";
|
static displayName = "Mask";
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
import Shape from "./Shape";
|
|
||||||
import extractProps from "../lib/extract/extractProps";
|
import extractProps from "../lib/extract/extractProps";
|
||||||
|
import Shape from "./Shape";
|
||||||
|
|
||||||
export default class extends Shape {
|
export default class extends Shape {
|
||||||
static displayName = "Path";
|
static displayName = "Path";
|
||||||
|
|||||||
+1
-1
@@ -1,8 +1,8 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
import units from "../lib/units";
|
|
||||||
import extractTransform from "../lib/extract/extractTransform";
|
import extractTransform from "../lib/extract/extractTransform";
|
||||||
import extractViewBox from "../lib/extract/extractViewBox";
|
import extractViewBox from "../lib/extract/extractViewBox";
|
||||||
|
import units from "../lib/units";
|
||||||
|
|
||||||
export default class extends Component {
|
export default class extends Component {
|
||||||
static displayName = "Pattern";
|
static displayName = "Pattern";
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Path from "./Path";
|
import Path from "./Path";
|
||||||
import extractPolyPoints from "../lib/extract/extractPolyPoints";
|
|
||||||
import Shape from "./Shape";
|
import Shape from "./Shape";
|
||||||
|
import extractPolyPoints from "../lib/extract/extractPolyPoints";
|
||||||
|
|
||||||
export default class extends Shape {
|
export default class extends Shape {
|
||||||
static displayName = "Polygon";
|
static displayName = "Polygon";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Path from "./Path";
|
import Path from "./Path";
|
||||||
import extractPolyPoints from "../lib/extract/extractPolyPoints";
|
|
||||||
import Shape from "./Shape";
|
import Shape from "./Shape";
|
||||||
|
import extractPolyPoints from "../lib/extract/extractPolyPoints";
|
||||||
|
|
||||||
export default class extends Shape {
|
export default class extends Shape {
|
||||||
static displayName = "Polyline";
|
static displayName = "Polyline";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import extractGradient from "../lib/extract/extractGradient";
|
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
|
import extractGradient from "../lib/extract/extractGradient";
|
||||||
|
|
||||||
export default class extends Component {
|
export default class extends Component {
|
||||||
static displayName = "RadialGradient";
|
static displayName = "RadialGradient";
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import "./Path"; // must import Path first, don`t know why. without this will throw an `Super expression must either be null or a function, not undefined`
|
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
import extractProps from "../lib/extract/extractProps";
|
import extractProps from "../lib/extract/extractProps";
|
||||||
import Shape from "./Shape";
|
import Shape from "./Shape";
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import extractViewBox from "../lib/extract/extractViewBox";
|
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
|
import extractViewBox from "../lib/extract/extractViewBox";
|
||||||
|
|
||||||
export default class extends Component {
|
export default class extends Component {
|
||||||
static displayName = "Symbol";
|
static displayName = "Symbol";
|
||||||
|
|||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
import extractText, { setTSpan } from "../lib/extract/extractText";
|
|
||||||
import extractProps from "../lib/extract/extractProps";
|
import extractProps from "../lib/extract/extractProps";
|
||||||
import extractTransform from "../lib/extract/extractTransform";
|
import extractTransform from "../lib/extract/extractTransform";
|
||||||
import Shape from "./Shape";
|
import extractText, { setTSpan } from "../lib/extract/extractText";
|
||||||
import { pickNotNil } from "../lib/util";
|
import { pickNotNil } from "../lib/util";
|
||||||
|
import Shape from "./Shape";
|
||||||
|
|
||||||
export default class TSpan extends Shape {
|
export default class TSpan extends Shape {
|
||||||
static displayName = "TSpan";
|
static displayName = "TSpan";
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { requireNativeComponent } from "react-native";
|
import { requireNativeComponent } from "react-native";
|
||||||
import extractText from "../lib/extract/extractText";
|
import extractText from "../lib/extract/extractText";
|
||||||
import extractProps from "../lib/extract/extractProps";
|
import extractProps from "../lib/extract/extractProps";
|
||||||
|
|||||||
@@ -56,10 +56,15 @@ RNSVGFontData *RNSVGFontData_Defaults;
|
|||||||
RNSVGFontData *data = [RNSVGFontData alloc];
|
RNSVGFontData *data = [RNSVGFontData alloc];
|
||||||
CGFloat parentFontSize = parent->fontSize;
|
CGFloat parentFontSize = parent->fontSize;
|
||||||
if ([font objectForKey:FONT_SIZE]) {
|
if ([font objectForKey:FONT_SIZE]) {
|
||||||
NSString *string = [font objectForKey:FONT_SIZE];
|
id fontSize = [font objectForKey:FONT_SIZE];
|
||||||
data->fontSize = [RNSVGPropHelper fromRelativeWithNSString:string
|
if ([fontSize isKindOfClass:NSNumber.class]) {
|
||||||
|
NSNumber* fs = fontSize;
|
||||||
|
data->fontSize = (CGFloat)[fs doubleValue];
|
||||||
|
} else {
|
||||||
|
data->fontSize = [RNSVGPropHelper fromRelativeWithNSString:fontSize
|
||||||
relative:parentFontSize
|
relative:parentFontSize
|
||||||
fontSize:parentFontSize];
|
fontSize:parentFontSize];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data->fontSize = parentFontSize;
|
data->fontSize = parentFontSize;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
const meetOrSliceTypes = {
|
export const meetOrSliceTypes = {
|
||||||
meet: 0,
|
meet: 0,
|
||||||
slice: 1,
|
slice: 1,
|
||||||
none: 2,
|
none: 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
const alignEnum = [
|
export const alignEnum = [
|
||||||
"xMinYMin",
|
"xMinYMin",
|
||||||
"xMidYMin",
|
"xMidYMin",
|
||||||
"xMaxYMin",
|
"xMaxYMin",
|
||||||
@@ -56,5 +56,3 @@ export default function(props) {
|
|||||||
meetOrSlice,
|
meetOrSlice,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export { meetOrSliceTypes, alignEnum };
|
|
||||||
|
|||||||
Reference in New Issue
Block a user