Files
react-native-svg/src/fabric/ClipPathNativeComponent.ts
Wojciech Lewicki 3a04189df8 fix: reanimated on old architecture (#1869)
PR adding option for `Double` for all props that were of type `NumberProp` on `Android` so `reanimated` works the same as before on old architecture. It also introduces the change of how `fill` and `stroke` should be constructed for options not going through `render` method, e.g. `react-native-reanimated`. An example of how to handle it can be seen in the provided example: https://github.com/react-native-svg/react-native-svg/pull/1869/files#diff-76a76277daf14518270e8aea8a5e9358a8215d7e4276d2e5f1c4fe95107cdc20
2022-09-15 12:08:57 +02:00

76 lines
1.9 KiB
TypeScript

import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type { ColorValue, ViewProps } from 'react-native';
import type {
Float,
Int32,
WithDefault,
} from 'react-native/Libraries/Types/CodegenTypes';
interface SvgNodeCommonProps {
name?: string;
opacity?: WithDefault<Float, 1.0>;
matrix?: ReadonlyArray<Float>;
// transform?: ____TransformStyle_Internal, // CATransform3D, custom handling
mask?: string;
markerStart?: string;
markerMid?: string;
markerEnd?: string;
clipPath?: string;
clipRule?: WithDefault<Int32, 0>;
responsible?: boolean;
display?: string;
}
type ColorStruct = Readonly<{
type?: WithDefault<Int32, -1>;
payload?: ColorValue;
brushRef?: string;
}>;
interface SvgRenderableCommonProps {
fill?: ColorStruct;
fillOpacity?: WithDefault<Float, 1.0>;
fillRule?: WithDefault<Int32, 1>;
stroke?: ColorStruct;
strokeOpacity?: WithDefault<Float, 1.0>;
strokeWidth?: WithDefault<string, '1'>;
strokeLinecap?: WithDefault<Int32, 0>;
strokeLinejoin?: WithDefault<Int32, 0>;
strokeDasharray?: ReadonlyArray<string>;
strokeDashoffset?: Float;
strokeMiterlimit?: Float;
vectorEffect?: WithDefault<Int32, 0>;
propList?: ReadonlyArray<string>;
}
type FontObject = Readonly<{
fontStyle?: string;
fontVariant?: string;
fontWeight?: string;
fontStretch?: string;
fontSize?: string;
fontFamily?: string;
textAnchor?: string;
textDecoration?: string;
letterSpacing?: string;
wordSpacing?: string;
kerning?: string;
fontFeatureSettings?: string;
fontVariantLigatures?: string;
fontVariationSettings?: string;
}>;
interface SvgGroupCommonProps {
fontSize?: string;
fontWeight?: string;
font?: FontObject;
}
interface NativeProps
extends ViewProps,
SvgNodeCommonProps,
SvgRenderableCommonProps,
SvgGroupCommonProps {}
export default codegenNativeComponent<NativeProps>('RNSVGClipPath');