mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 14:05:09 +00:00
38 lines
983 B
JavaScript
38 lines
983 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import createReactNativeComponentClass from 'react-native/Libraries/Renderer/shims/createReactNativeComponentClass.js';
|
|
import {PathAttributes} from '../lib/attributes';
|
|
import Shape from './Shape';
|
|
import {pathProps} from '../lib/props';
|
|
import extractProps from '../lib/extract/extractProps';
|
|
|
|
export default class extends Shape {
|
|
static displayName = 'Path';
|
|
|
|
static propTypes = {
|
|
...pathProps,
|
|
d: PropTypes.string.isRequired
|
|
};
|
|
|
|
setNativeProps = (...args) => {
|
|
this.root.setNativeProps(...args);
|
|
};
|
|
|
|
render() {
|
|
let props = this.props;
|
|
|
|
return (
|
|
<RNSVGPath
|
|
ref={ele => {this.root = ele;}}
|
|
{...extractProps(props, this)}
|
|
d={props.d}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
const RNSVGPath = createReactNativeComponentClass({
|
|
validAttributes: PathAttributes,
|
|
uiViewClassName: 'RNSVGPath'
|
|
});
|