Allow numeric dimensions in Use element, cleanup Svg element.

This commit is contained in:
Mikael Sand
2018-04-04 21:55:03 +03:00
parent 046c7efc04
commit 5e1bb859fc
2 changed files with 7 additions and 9 deletions
+5 -7
View File
@@ -10,6 +10,7 @@ import {
} from "react-native";
import extractViewBox from "../lib/extract/extractViewBox";
import { ViewBoxAttributes } from "../lib/attributes";
import { numberProp } from "../lib/props";
/** @namespace NativeModules.RNSVGSvgViewManager */
const RNSVGSvgViewManager = NativeModules.RNSVGSvgViewManager;
@@ -27,9 +28,9 @@ class Svg extends Component {
static displayName = "Svg";
static propTypes = {
...ViewPropTypes,
opacity: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
opacity: numberProp,
width: numberProp,
height: numberProp,
// more detail https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute
viewBox: PropTypes.string,
preserveAspectRatio: PropTypes.string
@@ -41,10 +42,7 @@ class Svg extends Component {
constructor() {
super(...arguments);
id++;
this.id = id;
//noinspection JSUnusedGlobalSymbols
this.onDataURLCallbacks = [];
this.id = ++id;
}
measureInWindow = (...args) => {
this.root.measureInWindow(...args);