-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathSymbol.tsx
33 lines (30 loc) · 910 Bytes
/
Symbol.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import type { ReactNode } from 'react';
import * as React from 'react';
import extractViewBox from '../lib/extract/extractViewBox';
import Shape from './Shape';
import RNSVGSymbol from '../fabric/SymbolNativeComponent';
import type { NumberProp } from '../lib/extract/types';
import type { NativeMethods } from 'react-native';
export interface SymbolProps {
children?: ReactNode;
id?: string;
viewBox?: string;
preserveAspectRatio?: string;
opacity?: NumberProp;
}
export default class Symbol extends Shape<SymbolProps> {
static displayName = 'Symbol';
render() {
const { props } = this;
const { id, children } = props;
const symbolProps = { name: id };
return (
<RNSVGSymbol
ref={(ref) => this.refMethod(ref as Shape<SymbolProps> & NativeMethods)}
{...symbolProps}
{...extractViewBox(props)}>
{children}
</RNSVGSymbol>
);
}
}