mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-06 07:06:11 +00:00
# Summary Implement custom shadow nodes for nearly all `Svg` components. While it's a foundation for numerous upcoming changes, it currently addresses and resolves #2544. ## Test Plan There shouldn't be any noticeable changes, and everything should function as before, except that `onLayout` will now be triggered only once and with the correct dimensions. ## Compatibility | OS | Implemented | | ------- | :---------: | | iOS | ✅ | | MacOS | ✅ | | Android | ✅ | --------- Co-authored-by: Jakub Piasecki <jakubpiasecki67@gmail.com>
65 lines
1.7 KiB
TypeScript
65 lines
1.7 KiB
TypeScript
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
import type { ColorValue } from 'react-native';
|
|
import type {
|
|
Float,
|
|
Int32,
|
|
WithDefault,
|
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
import type { ViewProps } from './utils';
|
|
|
|
import type { UnsafeMixed } from './codegenUtils';
|
|
import { NumberProp } from '../lib/extract/types';
|
|
|
|
interface SvgNodeCommonProps {
|
|
name?: string;
|
|
opacity?: WithDefault<Float, 1.0>;
|
|
matrix?: ReadonlyArray<Float>;
|
|
mask?: string;
|
|
markerStart?: string;
|
|
markerMid?: string;
|
|
markerEnd?: string;
|
|
clipPath?: string;
|
|
clipRule?: WithDefault<Int32, 0>;
|
|
responsible?: boolean;
|
|
display?: string;
|
|
pointerEvents?: string;
|
|
}
|
|
|
|
type ColorStruct = Readonly<{
|
|
type?: WithDefault<Int32, -1>;
|
|
payload?: ColorValue;
|
|
brushRef?: string;
|
|
}>;
|
|
|
|
interface SvgRenderableCommonProps {
|
|
color?: ColorValue;
|
|
fill?: UnsafeMixed<ColorValue | ColorStruct>;
|
|
fillOpacity?: WithDefault<Float, 1.0>;
|
|
fillRule?: WithDefault<Int32, 1>;
|
|
stroke?: UnsafeMixed<ColorValue | ColorStruct>;
|
|
strokeOpacity?: WithDefault<Float, 1.0>;
|
|
strokeWidth?: UnsafeMixed<NumberProp>;
|
|
strokeLinecap?: WithDefault<Int32, 0>;
|
|
strokeLinejoin?: WithDefault<Int32, 0>;
|
|
strokeDasharray?: UnsafeMixed<ReadonlyArray<NumberProp> | NumberProp>;
|
|
strokeDashoffset?: Float;
|
|
strokeMiterlimit?: Float;
|
|
vectorEffect?: WithDefault<Int32, 0>;
|
|
propList?: ReadonlyArray<string>;
|
|
filter?: string;
|
|
}
|
|
|
|
interface NativeProps
|
|
extends ViewProps,
|
|
SvgNodeCommonProps,
|
|
SvgRenderableCommonProps {
|
|
x1?: UnsafeMixed<NumberProp>;
|
|
y1?: UnsafeMixed<NumberProp>;
|
|
x2?: UnsafeMixed<NumberProp>;
|
|
y2?: UnsafeMixed<NumberProp>;
|
|
}
|
|
|
|
export default codegenNativeComponent<NativeProps>('RNSVGLine', {
|
|
interfaceOnly: true,
|
|
});
|