mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-03 15:14:18 +00:00
Allow numeric dimensions in Use element, cleanup Svg element.
This commit is contained in:
+5
-7
@@ -10,6 +10,7 @@ import {
|
|||||||
} from "react-native";
|
} from "react-native";
|
||||||
import extractViewBox from "../lib/extract/extractViewBox";
|
import extractViewBox from "../lib/extract/extractViewBox";
|
||||||
import { ViewBoxAttributes } from "../lib/attributes";
|
import { ViewBoxAttributes } from "../lib/attributes";
|
||||||
|
import { numberProp } from "../lib/props";
|
||||||
|
|
||||||
/** @namespace NativeModules.RNSVGSvgViewManager */
|
/** @namespace NativeModules.RNSVGSvgViewManager */
|
||||||
const RNSVGSvgViewManager = NativeModules.RNSVGSvgViewManager;
|
const RNSVGSvgViewManager = NativeModules.RNSVGSvgViewManager;
|
||||||
@@ -27,9 +28,9 @@ class Svg extends Component {
|
|||||||
static displayName = "Svg";
|
static displayName = "Svg";
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
...ViewPropTypes,
|
...ViewPropTypes,
|
||||||
opacity: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
opacity: numberProp,
|
||||||
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
width: numberProp,
|
||||||
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
height: numberProp,
|
||||||
// more detail https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute
|
// more detail https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute
|
||||||
viewBox: PropTypes.string,
|
viewBox: PropTypes.string,
|
||||||
preserveAspectRatio: PropTypes.string
|
preserveAspectRatio: PropTypes.string
|
||||||
@@ -41,10 +42,7 @@ class Svg extends Component {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
id++;
|
this.id = ++id;
|
||||||
this.id = id;
|
|
||||||
//noinspection JSUnusedGlobalSymbols
|
|
||||||
this.onDataURLCallbacks = [];
|
|
||||||
}
|
}
|
||||||
measureInWindow = (...args) => {
|
measureInWindow = (...args) => {
|
||||||
this.root.measureInWindow(...args);
|
this.root.measureInWindow(...args);
|
||||||
|
|||||||
+2
-2
@@ -46,8 +46,8 @@ export default class extends Shape {
|
|||||||
}}
|
}}
|
||||||
{...extractProps(props, this)}
|
{...extractProps(props, this)}
|
||||||
href={href}
|
href={href}
|
||||||
width={props.width}
|
width={props.width.toString()}
|
||||||
height={props.height}
|
height={props.height.toString()}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</RNSVGUse>
|
</RNSVGUse>
|
||||||
|
|||||||
Reference in New Issue
Block a user