From 840f1df4c53ae49c6ee6d54e1778dca24e79e5d5 Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Thu, 21 Nov 2024 11:00:38 +0100 Subject: [PATCH 1/8] feat: add interfaceOnly --- src/fabric/CircleNativeComponent.ts | 4 +++- src/fabric/ClipPathNativeComponent.ts | 4 +++- src/fabric/DefsNativeComponent.ts | 4 +++- src/fabric/EllipseNativeComponent.ts | 4 +++- src/fabric/FeBlendNativeComponent.ts | 4 +++- src/fabric/FeColorMatrixNativeComponent.ts | 4 +++- src/fabric/FeCompositeNativeComponent.ts | 4 +++- src/fabric/FeFloodNativeComponent.ts | 4 +++- src/fabric/FeGaussianBlurNativeComponent.ts | 4 +++- src/fabric/FeMergeNativeComponent.ts | 4 +++- src/fabric/FeOffsetNativeComponent.ts | 4 +++- src/fabric/FilterNativeComponent.ts | 4 +++- src/fabric/ForeignObjectNativeComponent.ts | 4 +++- src/fabric/GroupNativeComponent.ts | 4 +++- src/fabric/LineNativeComponent.ts | 4 +++- src/fabric/LinearGradientNativeComponent.ts | 4 +++- src/fabric/MarkerNativeComponent.ts | 4 +++- src/fabric/MaskNativeComponent.ts | 4 +++- src/fabric/PathNativeComponent.ts | 4 +++- src/fabric/PatternNativeComponent.ts | 4 +++- src/fabric/RadialGradientNativeComponent.ts | 4 +++- src/fabric/RectNativeComponent.ts | 4 +++- src/fabric/SymbolNativeComponent.ts | 4 +++- src/fabric/TSpanNativeComponent.ts | 4 +++- src/fabric/TextNativeComponent.ts | 4 +++- src/fabric/TextPathNativeComponent.ts | 4 +++- src/fabric/UseNativeComponent.ts | 4 +++- 27 files changed, 81 insertions(+), 27 deletions(-) diff --git a/src/fabric/CircleNativeComponent.ts b/src/fabric/CircleNativeComponent.ts index 05189a56e..09ec6df5e 100644 --- a/src/fabric/CircleNativeComponent.ts +++ b/src/fabric/CircleNativeComponent.ts @@ -58,4 +58,6 @@ interface NativeProps r?: UnsafeMixed; } -export default codegenNativeComponent('RNSVGCircle'); +export default codegenNativeComponent('RNSVGCircle', { + interfaceOnly: true, +}); diff --git a/src/fabric/ClipPathNativeComponent.ts b/src/fabric/ClipPathNativeComponent.ts index 8dfdc7e32..d9c79ca4d 100644 --- a/src/fabric/ClipPathNativeComponent.ts +++ b/src/fabric/ClipPathNativeComponent.ts @@ -61,4 +61,6 @@ interface NativeProps SvgRenderableCommonProps, SvgGroupCommonProps {} -export default codegenNativeComponent('RNSVGClipPath'); +export default codegenNativeComponent('RNSVGClipPath', { + interfaceOnly: true, +}); diff --git a/src/fabric/DefsNativeComponent.ts b/src/fabric/DefsNativeComponent.ts index cf517b1a0..b0392a9d6 100644 --- a/src/fabric/DefsNativeComponent.ts +++ b/src/fabric/DefsNativeComponent.ts @@ -23,4 +23,6 @@ interface SvgNodeCommonProps { interface NativeProps extends ViewProps, SvgNodeCommonProps {} -export default codegenNativeComponent('RNSVGDefs'); +export default codegenNativeComponent('RNSVGDefs', { + interfaceOnly: true, +}); diff --git a/src/fabric/EllipseNativeComponent.ts b/src/fabric/EllipseNativeComponent.ts index 5b306a500..4773f8316 100644 --- a/src/fabric/EllipseNativeComponent.ts +++ b/src/fabric/EllipseNativeComponent.ts @@ -59,4 +59,6 @@ interface NativeProps ry?: UnsafeMixed; } -export default codegenNativeComponent('RNSVGEllipse'); +export default codegenNativeComponent('RNSVGEllipse', { + interfaceOnly: true, +}); diff --git a/src/fabric/FeBlendNativeComponent.ts b/src/fabric/FeBlendNativeComponent.ts index 67c0d722a..ceca9f44b 100644 --- a/src/fabric/FeBlendNativeComponent.ts +++ b/src/fabric/FeBlendNativeComponent.ts @@ -26,4 +26,6 @@ export interface NativeProps extends ViewProps, FilterPrimitiveCommonProps { mode?: WithDefault; } -export default codegenNativeComponent('RNSVGFeBlend'); +export default codegenNativeComponent('RNSVGFeBlend', { + interfaceOnly: true, +}); diff --git a/src/fabric/FeColorMatrixNativeComponent.ts b/src/fabric/FeColorMatrixNativeComponent.ts index 62f167d25..6f0ed7818 100644 --- a/src/fabric/FeColorMatrixNativeComponent.ts +++ b/src/fabric/FeColorMatrixNativeComponent.ts @@ -21,4 +21,6 @@ export interface NativeProps extends ViewProps, FilterPrimitiveCommonProps { values?: ReadonlyArray; } -export default codegenNativeComponent('RNSVGFeColorMatrix'); +export default codegenNativeComponent('RNSVGFeColorMatrix', { + interfaceOnly: true, +}); diff --git a/src/fabric/FeCompositeNativeComponent.ts b/src/fabric/FeCompositeNativeComponent.ts index bdf2041ad..1ea512380 100644 --- a/src/fabric/FeCompositeNativeComponent.ts +++ b/src/fabric/FeCompositeNativeComponent.ts @@ -31,4 +31,6 @@ export interface NativeProps extends ViewProps, FilterPrimitiveCommonProps { k4?: Float; } -export default codegenNativeComponent('RNSVGFeComposite'); +export default codegenNativeComponent('RNSVGFeComposite', { + interfaceOnly: true, +}); diff --git a/src/fabric/FeFloodNativeComponent.ts b/src/fabric/FeFloodNativeComponent.ts index 82d2b68ee..ae6fa8e75 100644 --- a/src/fabric/FeFloodNativeComponent.ts +++ b/src/fabric/FeFloodNativeComponent.ts @@ -28,4 +28,6 @@ export interface NativeProps extends ViewProps, FilterPrimitiveCommonProps { floodOpacity?: WithDefault; } -export default codegenNativeComponent('RNSVGFeFlood'); +export default codegenNativeComponent('RNSVGFeFlood', { + interfaceOnly: true, +}); diff --git a/src/fabric/FeGaussianBlurNativeComponent.ts b/src/fabric/FeGaussianBlurNativeComponent.ts index 440a0bba0..87fd3da29 100644 --- a/src/fabric/FeGaussianBlurNativeComponent.ts +++ b/src/fabric/FeGaussianBlurNativeComponent.ts @@ -22,4 +22,6 @@ export interface NativeProps extends ViewProps, FilterPrimitiveCommonProps { edgeMode?: WithDefault; } -export default codegenNativeComponent('RNSVGFeGaussianBlur'); +export default codegenNativeComponent('RNSVGFeGaussianBlur', { + interfaceOnly: true, +}); diff --git a/src/fabric/FeMergeNativeComponent.ts b/src/fabric/FeMergeNativeComponent.ts index 5dba04d33..a7741d732 100644 --- a/src/fabric/FeMergeNativeComponent.ts +++ b/src/fabric/FeMergeNativeComponent.ts @@ -16,4 +16,6 @@ export interface NativeProps extends ViewProps, FilterPrimitiveCommonProps { nodes?: ReadonlyArray; } -export default codegenNativeComponent('RNSVGFeMerge'); +export default codegenNativeComponent('RNSVGFeMerge', { + interfaceOnly: true, +}); diff --git a/src/fabric/FeOffsetNativeComponent.ts b/src/fabric/FeOffsetNativeComponent.ts index 403845ee9..d52833d77 100644 --- a/src/fabric/FeOffsetNativeComponent.ts +++ b/src/fabric/FeOffsetNativeComponent.ts @@ -18,4 +18,6 @@ export interface NativeProps extends ViewProps, FilterPrimitiveCommonProps { dy?: UnsafeMixed; } -export default codegenNativeComponent('RNSVGFeOffset'); +export default codegenNativeComponent('RNSVGFeOffset', { + interfaceOnly: true, +}); diff --git a/src/fabric/FilterNativeComponent.ts b/src/fabric/FilterNativeComponent.ts index 11066d079..2cabcd263 100644 --- a/src/fabric/FilterNativeComponent.ts +++ b/src/fabric/FilterNativeComponent.ts @@ -16,4 +16,6 @@ interface NativeProps extends ViewProps { primitiveUnits?: WithDefault; } -export default codegenNativeComponent('RNSVGFilter'); +export default codegenNativeComponent('RNSVGFilter', { + interfaceOnly: true, +}); diff --git a/src/fabric/ForeignObjectNativeComponent.ts b/src/fabric/ForeignObjectNativeComponent.ts index ada2fa89d..2acdb0342 100644 --- a/src/fabric/ForeignObjectNativeComponent.ts +++ b/src/fabric/ForeignObjectNativeComponent.ts @@ -66,4 +66,6 @@ interface NativeProps width?: UnsafeMixed; } -export default codegenNativeComponent('RNSVGForeignObject'); +export default codegenNativeComponent('RNSVGForeignObject', { + interfaceOnly: true, +}); diff --git a/src/fabric/GroupNativeComponent.ts b/src/fabric/GroupNativeComponent.ts index db52f1401..d509b8440 100644 --- a/src/fabric/GroupNativeComponent.ts +++ b/src/fabric/GroupNativeComponent.ts @@ -61,4 +61,6 @@ interface NativeProps SvgRenderableCommonProps, SvgGroupCommonProps {} -export default codegenNativeComponent('RNSVGGroup'); +export default codegenNativeComponent('RNSVGGroup', { + interfaceOnly: true, +}); diff --git a/src/fabric/LineNativeComponent.ts b/src/fabric/LineNativeComponent.ts index 4ee243121..ab0e45add 100644 --- a/src/fabric/LineNativeComponent.ts +++ b/src/fabric/LineNativeComponent.ts @@ -59,4 +59,6 @@ interface NativeProps y2?: UnsafeMixed; } -export default codegenNativeComponent('RNSVGLine'); +export default codegenNativeComponent('RNSVGLine', { + interfaceOnly: true, +}); diff --git a/src/fabric/LinearGradientNativeComponent.ts b/src/fabric/LinearGradientNativeComponent.ts index ee39834da..7b1d39c61 100644 --- a/src/fabric/LinearGradientNativeComponent.ts +++ b/src/fabric/LinearGradientNativeComponent.ts @@ -34,4 +34,6 @@ interface NativeProps extends ViewProps, SvgNodeCommonProps { gradientTransform?: ReadonlyArray | null; } -export default codegenNativeComponent('RNSVGLinearGradient'); +export default codegenNativeComponent('RNSVGLinearGradient', { + interfaceOnly: true, +}); diff --git a/src/fabric/MarkerNativeComponent.ts b/src/fabric/MarkerNativeComponent.ts index 57c004be0..a258d4571 100644 --- a/src/fabric/MarkerNativeComponent.ts +++ b/src/fabric/MarkerNativeComponent.ts @@ -74,4 +74,6 @@ interface NativeProps meetOrSlice?: Int32; } -export default codegenNativeComponent('RNSVGMarker'); +export default codegenNativeComponent('RNSVGMarker', { + interfaceOnly: true, +}); diff --git a/src/fabric/MaskNativeComponent.ts b/src/fabric/MaskNativeComponent.ts index 33c96f640..dac11a35f 100644 --- a/src/fabric/MaskNativeComponent.ts +++ b/src/fabric/MaskNativeComponent.ts @@ -69,4 +69,6 @@ interface NativeProps maskType?: Int32; } -export default codegenNativeComponent('RNSVGMask'); +export default codegenNativeComponent('RNSVGMask', { + interfaceOnly: true, +}); diff --git a/src/fabric/PathNativeComponent.ts b/src/fabric/PathNativeComponent.ts index b42518b74..5520ae183 100644 --- a/src/fabric/PathNativeComponent.ts +++ b/src/fabric/PathNativeComponent.ts @@ -56,4 +56,6 @@ interface NativeProps d?: string; } -export default codegenNativeComponent('RNSVGPath'); +export default codegenNativeComponent('RNSVGPath', { + interfaceOnly: true, +}); diff --git a/src/fabric/PatternNativeComponent.ts b/src/fabric/PatternNativeComponent.ts index be0669347..014458a78 100644 --- a/src/fabric/PatternNativeComponent.ts +++ b/src/fabric/PatternNativeComponent.ts @@ -75,4 +75,6 @@ interface NativeProps meetOrSlice?: Int32; } -export default codegenNativeComponent('RNSVGPattern'); +export default codegenNativeComponent('RNSVGPattern', { + interfaceOnly: true, +}); diff --git a/src/fabric/RadialGradientNativeComponent.ts b/src/fabric/RadialGradientNativeComponent.ts index 6a0ca935e..52409b049 100644 --- a/src/fabric/RadialGradientNativeComponent.ts +++ b/src/fabric/RadialGradientNativeComponent.ts @@ -36,4 +36,6 @@ interface NativeProps extends ViewProps, SvgNodeCommonProps { gradientTransform?: ReadonlyArray | null; } -export default codegenNativeComponent('RNSVGRadialGradient'); +export default codegenNativeComponent('RNSVGRadialGradient', { + interfaceOnly: true, +}); diff --git a/src/fabric/RectNativeComponent.ts b/src/fabric/RectNativeComponent.ts index 7a3a091aa..9d8f37ba0 100644 --- a/src/fabric/RectNativeComponent.ts +++ b/src/fabric/RectNativeComponent.ts @@ -61,4 +61,6 @@ interface NativeProps ry?: UnsafeMixed; } -export default codegenNativeComponent('RNSVGRect'); +export default codegenNativeComponent('RNSVGRect', { + interfaceOnly: true, +}); diff --git a/src/fabric/SymbolNativeComponent.ts b/src/fabric/SymbolNativeComponent.ts index 7a1fceea9..dde02a57b 100644 --- a/src/fabric/SymbolNativeComponent.ts +++ b/src/fabric/SymbolNativeComponent.ts @@ -68,4 +68,6 @@ interface NativeProps meetOrSlice?: Int32; } -export default codegenNativeComponent('RNSVGSymbol'); +export default codegenNativeComponent('RNSVGSymbol', { + interfaceOnly: true, +}); diff --git a/src/fabric/TSpanNativeComponent.ts b/src/fabric/TSpanNativeComponent.ts index 99e7de993..1e85f40bf 100644 --- a/src/fabric/TSpanNativeComponent.ts +++ b/src/fabric/TSpanNativeComponent.ts @@ -78,4 +78,6 @@ interface NativeProps content?: string; } -export default codegenNativeComponent('RNSVGTSpan'); +export default codegenNativeComponent('RNSVGTSpan', { + interfaceOnly: true, +}); diff --git a/src/fabric/TextNativeComponent.ts b/src/fabric/TextNativeComponent.ts index 62d50c701..539b228b9 100644 --- a/src/fabric/TextNativeComponent.ts +++ b/src/fabric/TextNativeComponent.ts @@ -76,4 +76,6 @@ interface NativeProps SvgGroupCommonProps, SvgTextCommonProps {} -export default codegenNativeComponent('RNSVGText'); +export default codegenNativeComponent('RNSVGText', { + interfaceOnly: true, +}); diff --git a/src/fabric/TextPathNativeComponent.ts b/src/fabric/TextPathNativeComponent.ts index 401b2e898..e6d630766 100644 --- a/src/fabric/TextPathNativeComponent.ts +++ b/src/fabric/TextPathNativeComponent.ts @@ -82,4 +82,6 @@ interface NativeProps startOffset?: UnsafeMixed; } -export default codegenNativeComponent('RNSVGTextPath'); +export default codegenNativeComponent('RNSVGTextPath', { + interfaceOnly: true, +}); diff --git a/src/fabric/UseNativeComponent.ts b/src/fabric/UseNativeComponent.ts index bb5d79967..e1e01bb53 100644 --- a/src/fabric/UseNativeComponent.ts +++ b/src/fabric/UseNativeComponent.ts @@ -60,4 +60,6 @@ interface NativeProps width?: UnsafeMixed; } -export default codegenNativeComponent('RNSVGUse'); +export default codegenNativeComponent('RNSVGUse', { + interfaceOnly: true, +}); From 528d4d32b7c500cb99d0310377d5448ba9299abe Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Thu, 21 Nov 2024 11:13:37 +0100 Subject: [PATCH 2/8] feat: change imports to custom component descriptors --- apple/Elements/RNSVGClipPath.mm | 2 +- apple/Elements/RNSVGDefs.mm | 2 +- apple/Elements/RNSVGForeignObject.mm | 2 +- apple/Elements/RNSVGGroup.mm | 2 +- apple/Elements/RNSVGLinearGradient.mm | 2 +- apple/Elements/RNSVGMarker.mm | 2 +- apple/Elements/RNSVGMask.mm | 2 +- apple/Elements/RNSVGPath.mm | 2 +- apple/Elements/RNSVGPattern.mm | 2 +- apple/Elements/RNSVGRadialGradient.mm | 2 +- apple/Elements/RNSVGSymbol.mm | 2 +- apple/Elements/RNSVGUse.mm | 2 +- apple/Filters/RNSVGFeBlend.mm | 2 +- apple/Filters/RNSVGFeColorMatrix.mm | 2 +- apple/Filters/RNSVGFeComposite.mm | 2 +- apple/Filters/RNSVGFeFlood.mm | 2 +- apple/Filters/RNSVGFeGaussianBlur.mm | 2 +- apple/Filters/RNSVGFeMerge.mm | 2 +- apple/Filters/RNSVGFeOffset.mm | 2 +- apple/Filters/RNSVGFilter.mm | 2 +- apple/Filters/RNSVGFilterPrimitive.mm | 2 +- apple/Shapes/RNSVGCircle.mm | 2 +- apple/Shapes/RNSVGEllipse.mm | 2 +- apple/Shapes/RNSVGLine.mm | 2 +- apple/Shapes/RNSVGRect.mm | 2 +- apple/Text/RNSVGTSpan.mm | 2 +- apple/Text/RNSVGText.mm | 2 +- apple/Text/RNSVGTextPath.mm | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/apple/Elements/RNSVGClipPath.mm b/apple/Elements/RNSVGClipPath.mm index 375d11760..b37dac61e 100644 --- a/apple/Elements/RNSVGClipPath.mm +++ b/apple/Elements/RNSVGClipPath.mm @@ -11,8 +11,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Elements/RNSVGDefs.mm b/apple/Elements/RNSVGDefs.mm index 00cea30c8..6300c1a35 100644 --- a/apple/Elements/RNSVGDefs.mm +++ b/apple/Elements/RNSVGDefs.mm @@ -10,8 +10,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Elements/RNSVGForeignObject.mm b/apple/Elements/RNSVGForeignObject.mm index 164726111..026c7e803 100644 --- a/apple/Elements/RNSVGForeignObject.mm +++ b/apple/Elements/RNSVGForeignObject.mm @@ -13,8 +13,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Elements/RNSVGGroup.mm b/apple/Elements/RNSVGGroup.mm index 44acf6308..d5e06b9c1 100644 --- a/apple/Elements/RNSVGGroup.mm +++ b/apple/Elements/RNSVGGroup.mm @@ -13,8 +13,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Elements/RNSVGLinearGradient.mm b/apple/Elements/RNSVGLinearGradient.mm index 0da30060b..ffaae2008 100644 --- a/apple/Elements/RNSVGLinearGradient.mm +++ b/apple/Elements/RNSVGLinearGradient.mm @@ -12,8 +12,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Elements/RNSVGMarker.mm b/apple/Elements/RNSVGMarker.mm index 0944a2f4d..bd026400e 100644 --- a/apple/Elements/RNSVGMarker.mm +++ b/apple/Elements/RNSVGMarker.mm @@ -14,8 +14,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Elements/RNSVGMask.mm b/apple/Elements/RNSVGMask.mm index 6a1fba938..f5abdec28 100644 --- a/apple/Elements/RNSVGMask.mm +++ b/apple/Elements/RNSVGMask.mm @@ -13,8 +13,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Elements/RNSVGPath.mm b/apple/Elements/RNSVGPath.mm index 25f9e11d4..c85a78a5e 100644 --- a/apple/Elements/RNSVGPath.mm +++ b/apple/Elements/RNSVGPath.mm @@ -11,8 +11,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Elements/RNSVGPattern.mm b/apple/Elements/RNSVGPattern.mm index ace93c8c1..d43992ed7 100644 --- a/apple/Elements/RNSVGPattern.mm +++ b/apple/Elements/RNSVGPattern.mm @@ -13,8 +13,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Elements/RNSVGRadialGradient.mm b/apple/Elements/RNSVGRadialGradient.mm index bfbf971bc..589ef0530 100644 --- a/apple/Elements/RNSVGRadialGradient.mm +++ b/apple/Elements/RNSVGRadialGradient.mm @@ -10,8 +10,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Elements/RNSVGSymbol.mm b/apple/Elements/RNSVGSymbol.mm index 831fc3029..b1fbd4a65 100644 --- a/apple/Elements/RNSVGSymbol.mm +++ b/apple/Elements/RNSVGSymbol.mm @@ -11,8 +11,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Elements/RNSVGUse.mm b/apple/Elements/RNSVGUse.mm index 63b987c58..00088e1df 100644 --- a/apple/Elements/RNSVGUse.mm +++ b/apple/Elements/RNSVGUse.mm @@ -12,8 +12,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Filters/RNSVGFeBlend.mm b/apple/Filters/RNSVGFeBlend.mm index 00928a402..95966e956 100644 --- a/apple/Filters/RNSVGFeBlend.mm +++ b/apple/Filters/RNSVGFeBlend.mm @@ -3,8 +3,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGConvert.h" #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Filters/RNSVGFeColorMatrix.mm b/apple/Filters/RNSVGFeColorMatrix.mm index a8fd5226f..826b26178 100644 --- a/apple/Filters/RNSVGFeColorMatrix.mm +++ b/apple/Filters/RNSVGFeColorMatrix.mm @@ -3,8 +3,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGConvert.h" #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Filters/RNSVGFeComposite.mm b/apple/Filters/RNSVGFeComposite.mm index 4aa9dc1f1..45839bc58 100644 --- a/apple/Filters/RNSVGFeComposite.mm +++ b/apple/Filters/RNSVGFeComposite.mm @@ -5,8 +5,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGConvert.h" #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Filters/RNSVGFeFlood.mm b/apple/Filters/RNSVGFeFlood.mm index 75cff49f8..63ed92e17 100644 --- a/apple/Filters/RNSVGFeFlood.mm +++ b/apple/Filters/RNSVGFeFlood.mm @@ -3,8 +3,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGConvert.h" #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Filters/RNSVGFeGaussianBlur.mm b/apple/Filters/RNSVGFeGaussianBlur.mm index 3361352f3..4fa00c9ca 100644 --- a/apple/Filters/RNSVGFeGaussianBlur.mm +++ b/apple/Filters/RNSVGFeGaussianBlur.mm @@ -4,8 +4,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGConvert.h" #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Filters/RNSVGFeMerge.mm b/apple/Filters/RNSVGFeMerge.mm index 7dc200a9c..5ea542d10 100644 --- a/apple/Filters/RNSVGFeMerge.mm +++ b/apple/Filters/RNSVGFeMerge.mm @@ -3,8 +3,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Filters/RNSVGFeOffset.mm b/apple/Filters/RNSVGFeOffset.mm index ca236e043..df4fb2523 100644 --- a/apple/Filters/RNSVGFeOffset.mm +++ b/apple/Filters/RNSVGFeOffset.mm @@ -6,8 +6,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Filters/RNSVGFilter.mm b/apple/Filters/RNSVGFilter.mm index 0e8889eea..6edb4d2c6 100644 --- a/apple/Filters/RNSVGFilter.mm +++ b/apple/Filters/RNSVGFilter.mm @@ -5,10 +5,10 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import #import "RNSVGConvert.h" #import "RNSVGFabricConversions.h" +#import "rnsvg/RNSVGComponentDescriptors.h" #endif // RCT_NEW_ARCH_ENABLED #if TARGET_OS_OSX // [macOS diff --git a/apple/Filters/RNSVGFilterPrimitive.mm b/apple/Filters/RNSVGFilterPrimitive.mm index 195bc48ad..9dbd5dba7 100644 --- a/apple/Filters/RNSVGFilterPrimitive.mm +++ b/apple/Filters/RNSVGFilterPrimitive.mm @@ -5,8 +5,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Shapes/RNSVGCircle.mm b/apple/Shapes/RNSVGCircle.mm index 96e073607..29ed33098 100644 --- a/apple/Shapes/RNSVGCircle.mm +++ b/apple/Shapes/RNSVGCircle.mm @@ -12,8 +12,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Shapes/RNSVGEllipse.mm b/apple/Shapes/RNSVGEllipse.mm index 0827faf5a..9da51641f 100644 --- a/apple/Shapes/RNSVGEllipse.mm +++ b/apple/Shapes/RNSVGEllipse.mm @@ -12,8 +12,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Shapes/RNSVGLine.mm b/apple/Shapes/RNSVGLine.mm index e091ee605..79d0a7e6f 100644 --- a/apple/Shapes/RNSVGLine.mm +++ b/apple/Shapes/RNSVGLine.mm @@ -12,8 +12,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Shapes/RNSVGRect.mm b/apple/Shapes/RNSVGRect.mm index dc84611ec..e98ff8707 100644 --- a/apple/Shapes/RNSVGRect.mm +++ b/apple/Shapes/RNSVGRect.mm @@ -12,8 +12,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Text/RNSVGTSpan.mm b/apple/Text/RNSVGTSpan.mm index 5f3039eb2..2e06de346 100644 --- a/apple/Text/RNSVGTSpan.mm +++ b/apple/Text/RNSVGTSpan.mm @@ -20,8 +20,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Text/RNSVGText.mm b/apple/Text/RNSVGText.mm index 8dc81f982..42cfe22c2 100644 --- a/apple/Text/RNSVGText.mm +++ b/apple/Text/RNSVGText.mm @@ -16,8 +16,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED diff --git a/apple/Text/RNSVGTextPath.mm b/apple/Text/RNSVGTextPath.mm index c37c082d0..a6296d73c 100644 --- a/apple/Text/RNSVGTextPath.mm +++ b/apple/Text/RNSVGTextPath.mm @@ -11,8 +11,8 @@ #ifdef RCT_NEW_ARCH_ENABLED #import #import -#import #import +#import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED From b7a8a5bf966ea333a93eecb3bffc5a8d975ba4ee Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Wed, 4 Dec 2024 11:34:48 +0100 Subject: [PATCH 3/8] feat: set 0 dimensions for SVG elements --- android/src/main/jni/rnsvg.h | 1 + .../rnsvg/RNSVGComponentDescriptors.cpp | 65 +++++ .../rnsvg/RNSVGComponentDescriptors.h | 67 +++++ .../rnsvg/RNSVGConcreteShadowNode.h | 70 ++++++ .../rnsvg/RNSVGLayoutableShadowNode.cpp | 34 +++ .../rnsvg/RNSVGLayoutableShadowNode.h | 19 ++ .../components/rnsvg/RNSVGShadowNodes.cpp | 33 +++ .../components/rnsvg/RNSVGShadowNodes.h | 233 ++++++++++++++++++ 8 files changed, 522 insertions(+) create mode 100644 common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp create mode 100644 common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h create mode 100644 common/cpp/react/renderer/components/rnsvg/RNSVGConcreteShadowNode.h create mode 100644 common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp create mode 100644 common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.h create mode 100644 common/cpp/react/renderer/components/rnsvg/RNSVGShadowNodes.cpp create mode 100644 common/cpp/react/renderer/components/rnsvg/RNSVGShadowNodes.h diff --git a/android/src/main/jni/rnsvg.h b/android/src/main/jni/rnsvg.h index 82c748cf8..032cecfce 100644 --- a/android/src/main/jni/rnsvg.h +++ b/android/src/main/jni/rnsvg.h @@ -3,6 +3,7 @@ #include #include #include +#include #include namespace facebook { diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp new file mode 100644 index 000000000..280f056e6 --- /dev/null +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp @@ -0,0 +1,65 @@ +#include "RNSVGComponentDescriptors.h" +#include +#include + +namespace facebook::react { + +void rnsvg_registerComponentDescriptorsFromCodegen( + std::shared_ptr registry) { + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add(concreteComponentDescriptorProvider< + RNSVGFeColorMatrixComponentDescriptor>()); + registry->add(concreteComponentDescriptorProvider< + RNSVGFeCompositeComponentDescriptor>()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add(concreteComponentDescriptorProvider< + RNSVGFeGaussianBlurComponentDescriptor>()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add(concreteComponentDescriptorProvider< + RNSVGForeignObjectComponentDescriptor>()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add(concreteComponentDescriptorProvider< + RNSVGLinearGradientComponentDescriptor>()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add(concreteComponentDescriptorProvider< + RNSVGRadialGradientComponentDescriptor>()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); + registry->add( + concreteComponentDescriptorProvider()); +} + +} // namespace facebook::react diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h new file mode 100644 index 000000000..b56f2abb4 --- /dev/null +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h @@ -0,0 +1,67 @@ +#pragma once + +#include +#include +#include "RNSVGShadowNodes.h" + +namespace facebook::react { + +using RNSVGCircleComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGClipPathComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGDefsComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGEllipseComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGFeBlendComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGFeColorMatrixComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGFeCompositeComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGFeFloodComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGFeGaussianBlurComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGFeMergeComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGFeOffsetComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGFilterComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGForeignObjectComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGGroupComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGLinearGradientComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGLineComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGMarkerComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGMaskComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGPathComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGPatternComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGRadialGradientComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGRectComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGSymbolComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGTextComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGTextPathComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGTSpanComponentDescriptor = + ConcreteComponentDescriptor; +using RNSVGUseComponentDescriptor = + ConcreteComponentDescriptor; + +void rnsvg_registerComponentDescriptorsFromCodegen( + std::shared_ptr registry); + +} // namespace facebook::react diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGConcreteShadowNode.h b/common/cpp/react/renderer/components/rnsvg/RNSVGConcreteShadowNode.h new file mode 100644 index 000000000..6ca0e9047 --- /dev/null +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGConcreteShadowNode.h @@ -0,0 +1,70 @@ +#pragma once + +#include +#include +#include +#include "RNSVGLayoutableShadowNode.h" + +namespace facebook::react { + +template +class RNSVGConcreteShadowNode : public ConcreteShadowNode< + concreteComponentName, + RNSVGLayoutableShadowNode, + PropsT, + ViewEventEmitter, + StateData, + false> { + public: + using BaseShadowNode = ConcreteShadowNode< + concreteComponentName, + RNSVGLayoutableShadowNode, + PropsT, + ViewEventEmitter, + StateData, + false>; + + RNSVGConcreteShadowNode( + const ShadowNodeFragment &fragment, + const ShadowNodeFamily::Shared &family, + ShadowNodeTraits traits) + : BaseShadowNode(fragment, family, traits) {} + + RNSVGConcreteShadowNode( + const ShadowNode &sourceShadowNode, + const ShadowNodeFragment &fragment) + : BaseShadowNode(sourceShadowNode, fragment) {} + + using ConcreteViewProps = PropsT; + + using BaseShadowNode::BaseShadowNode; + + static ShadowNodeTraits BaseTraits() { + auto traits = BaseShadowNode::BaseTraits(); + traits.set(ShadowNodeTraits::Trait::ViewKind); + traits.set(ShadowNodeTraits::Trait::FormsStackingContext); + traits.set(ShadowNodeTraits::Trait::FormsView); + return traits; + } + + Transform getTransform() const override { + auto layoutMetrics = BaseShadowNode::getLayoutMetrics(); + return BaseShadowNode::getConcreteProps().resolveTransform(layoutMetrics); + } + + bool canBeTouchTarget() const override { + auto pointerEvents = + BaseShadowNode::getConcreteProps().ViewProps::pointerEvents; + return pointerEvents == PointerEventsMode::Auto || + pointerEvents == PointerEventsMode::BoxOnly; + } + + bool canChildrenBeTouchTarget() const override { + auto pointerEvents = + BaseShadowNode::getConcreteProps().ViewProps::pointerEvents; + return pointerEvents == PointerEventsMode::Auto || + pointerEvents == PointerEventsMode::BoxNone; + } +}; + +} // namespace facebook::react diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp b/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp new file mode 100644 index 000000000..cde2fc16e --- /dev/null +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp @@ -0,0 +1,34 @@ +#include "RNSVGLayoutableShadowNode.h" +#include + +namespace facebook::react { + +RNSVGLayoutableShadowNode::RNSVGLayoutableShadowNode( + const ShadowNodeFragment &fragment, + const ShadowNodeFamily::Shared &family, + ShadowNodeTraits traits) + : YogaLayoutableShadowNode(fragment, family, traits) { + auto style = yogaNode_.style(); + style.setDimension(yoga::Dimension::Width, yoga::value::points(0)); + style.setDimension(yoga::Dimension::Height, yoga::value::points(0)); + yogaNode_.setStyle(style); +} + +RNSVGLayoutableShadowNode::RNSVGLayoutableShadowNode( + const ShadowNode &sourceShadowNode, + const ShadowNodeFragment &fragment) + : YogaLayoutableShadowNode(sourceShadowNode, fragment) { + auto style = yogaNode_.style(); + style.setDimension(yoga::Dimension::Width, yoga::value::points(0)); + style.setDimension(yoga::Dimension::Height, yoga::value::points(0)); + yogaNode_.setStyle(style); +} + +void RNSVGLayoutableShadowNode::layout(LayoutContext layoutContext) { + auto affectedNodes = layoutContext.affectedNodes; + layoutContext.affectedNodes = nullptr; + YogaLayoutableShadowNode::layout(layoutContext); + layoutContext.affectedNodes = affectedNodes; +} + +} // namespace facebook::react diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.h b/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.h new file mode 100644 index 000000000..968b1bff1 --- /dev/null +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.h @@ -0,0 +1,19 @@ +#include + +namespace facebook::react { + +class RNSVGLayoutableShadowNode : public YogaLayoutableShadowNode { + public: + RNSVGLayoutableShadowNode( + const ShadowNodeFragment &fragment, + const ShadowNodeFamily::Shared &family, + ShadowNodeTraits traits); + + RNSVGLayoutableShadowNode( + const ShadowNode &sourceShadowNode, + const ShadowNodeFragment &fragment); + + void layout(LayoutContext layoutContext) override; +}; + +} // namespace facebook::react diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGShadowNodes.cpp b/common/cpp/react/renderer/components/rnsvg/RNSVGShadowNodes.cpp new file mode 100644 index 000000000..70f1abd43 --- /dev/null +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGShadowNodes.cpp @@ -0,0 +1,33 @@ +#include + +namespace facebook::react { + +extern const char RNSVGCircleComponentName[] = "RNSVGCircle"; +extern const char RNSVGClipPathComponentName[] = "RNSVGClipPath"; +extern const char RNSVGDefsComponentName[] = "RNSVGDefs"; +extern const char RNSVGEllipseComponentName[] = "RNSVGEllipse"; +extern const char RNSVGFeBlendComponentName[] = "RNSVGFeBlend"; +extern const char RNSVGFeColorMatrixComponentName[] = "RNSVGFeColorMatrix"; +extern const char RNSVGFeCompositeComponentName[] = "RNSVGFeComposite"; +extern const char RNSVGFeFloodComponentName[] = "RNSVGFeFlood"; +extern const char RNSVGFeGaussianBlurComponentName[] = "RNSVGFeGaussianBlur"; +extern const char RNSVGFeMergeComponentName[] = "RNSVGFeMerge"; +extern const char RNSVGFeOffsetComponentName[] = "RNSVGFeOffset"; +extern const char RNSVGFilterComponentName[] = "RNSVGFilter"; +extern const char RNSVGForeignObjectComponentName[] = "RNSVGForeignObject"; +extern const char RNSVGGroupComponentName[] = "RNSVGGroup"; +extern const char RNSVGLinearGradientComponentName[] = "RNSVGLinearGradient"; +extern const char RNSVGLineComponentName[] = "RNSVGLine"; +extern const char RNSVGMarkerComponentName[] = "RNSVGMarker"; +extern const char RNSVGMaskComponentName[] = "RNSVGMask"; +extern const char RNSVGPathComponentName[] = "RNSVGPath"; +extern const char RNSVGPatternComponentName[] = "RNSVGPattern"; +extern const char RNSVGRadialGradientComponentName[] = "RNSVGRadialGradient"; +extern const char RNSVGRectComponentName[] = "RNSVGRect"; +extern const char RNSVGSymbolComponentName[] = "RNSVGSymbol"; +extern const char RNSVGTextComponentName[] = "RNSVGText"; +extern const char RNSVGTextPathComponentName[] = "RNSVGTextPath"; +extern const char RNSVGTSpanComponentName[] = "RNSVGTSpan"; +extern const char RNSVGUseComponentName[] = "RNSVGUse"; + +} // namespace facebook::react diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGShadowNodes.h b/common/cpp/react/renderer/components/rnsvg/RNSVGShadowNodes.h new file mode 100644 index 000000000..71addc842 --- /dev/null +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGShadowNodes.h @@ -0,0 +1,233 @@ +#pragma once + +#include +#include +#include +#include "RNSVGConcreteShadowNode.h" +#include "RNSVGImageState.h" + +namespace facebook::react { + +JSI_EXPORT extern const char RNSVGCircleComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGCircleShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGClipPathComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGClipPathShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGDefsComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGDefsShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGEllipseComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGEllipseShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGFeBlendComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGFeBlendShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGFeColorMatrixComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGFeColorMatrixShadowNode = RNSVGConcreteShadowNode< + RNSVGFeColorMatrixComponentName, + RNSVGFeColorMatrixProps>; + +JSI_EXPORT extern const char RNSVGFeCompositeComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGFeCompositeShadowNode = RNSVGConcreteShadowNode< + RNSVGFeCompositeComponentName, + RNSVGFeCompositeProps>; + +JSI_EXPORT extern const char RNSVGFeFloodComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGFeFloodShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGFeGaussianBlurComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGFeGaussianBlurShadowNode = RNSVGConcreteShadowNode< + RNSVGFeGaussianBlurComponentName, + RNSVGFeGaussianBlurProps>; + +JSI_EXPORT extern const char RNSVGFeMergeComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGFeMergeShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGFeOffsetComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGFeOffsetShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGFilterComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGFilterShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGForeignObjectComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGForeignObjectShadowNode = RNSVGConcreteShadowNode< + RNSVGForeignObjectComponentName, + RNSVGForeignObjectProps>; + +JSI_EXPORT extern const char RNSVGGroupComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGGroupShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGLinearGradientComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGLinearGradientShadowNode = RNSVGConcreteShadowNode< + RNSVGLinearGradientComponentName, + RNSVGLinearGradientProps>; + +JSI_EXPORT extern const char RNSVGLineComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGLineShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGMarkerComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGMarkerShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGMaskComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGMaskShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGPathComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGPathShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGPatternComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGPatternShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGRadialGradientComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGRadialGradientShadowNode = RNSVGConcreteShadowNode< + RNSVGRadialGradientComponentName, + RNSVGRadialGradientProps>; + +JSI_EXPORT extern const char RNSVGRectComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGRectShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGSymbolComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGSymbolShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGTextComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGTextShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGTextPathComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGTextPathShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGTSpanComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGTSpanShadowNode = + RNSVGConcreteShadowNode; + +JSI_EXPORT extern const char RNSVGUseComponentName[]; + +/* + * `ShadowNode` for component. + */ +using RNSVGUseShadowNode = + RNSVGConcreteShadowNode; + +} // namespace facebook::react From 7939a4987f69610e23de2969c9d75547651def32 Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Thu, 5 Dec 2024 16:45:59 +0100 Subject: [PATCH 4/8] fix: android component descriptors --- .../renderer/components/rnsvg/RNSVGComponentDescriptors.cpp | 4 +++- .../renderer/components/rnsvg/RNSVGComponentDescriptors.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp index 280f056e6..117c1b05a 100644 --- a/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp @@ -4,8 +4,10 @@ namespace facebook::react { -void rnsvg_registerComponentDescriptorsFromCodegen( +void rnsvg_registerComponentDescriptorsFromCodegena( std::shared_ptr registry) { + registry->add( + concreteComponentDescriptorProvider()); registry->add( concreteComponentDescriptorProvider()); registry->add( diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h index b56f2abb4..843df144e 100644 --- a/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h @@ -3,9 +3,12 @@ #include #include #include "RNSVGShadowNodes.h" +#include "RNSVGSvgViewShadowNode.h" namespace facebook::react { +using RNSVGSvgViewComponentDescriptor = + ConcreteComponentDescriptor; using RNSVGCircleComponentDescriptor = ConcreteComponentDescriptor; using RNSVGClipPathComponentDescriptor = @@ -61,7 +64,7 @@ using RNSVGTSpanComponentDescriptor = using RNSVGUseComponentDescriptor = ConcreteComponentDescriptor; -void rnsvg_registerComponentDescriptorsFromCodegen( +void rnsvg_registerComponentDescriptorsFromCodegena( std::shared_ptr registry); } // namespace facebook::react From e7867c63f5fcb748f25ae8648a75525fadc40813 Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Fri, 6 Dec 2024 12:23:47 +0100 Subject: [PATCH 5/8] fix: remove component deescriptors --- .../rnsvg/RNSVGComponentDescriptors.cpp | 67 ------------------- .../rnsvg/RNSVGComponentDescriptors.h | 6 -- 2 files changed, 73 deletions(-) delete mode 100644 common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp deleted file mode 100644 index 117c1b05a..000000000 --- a/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "RNSVGComponentDescriptors.h" -#include -#include - -namespace facebook::react { - -void rnsvg_registerComponentDescriptorsFromCodegena( - std::shared_ptr registry) { - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add(concreteComponentDescriptorProvider< - RNSVGFeColorMatrixComponentDescriptor>()); - registry->add(concreteComponentDescriptorProvider< - RNSVGFeCompositeComponentDescriptor>()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add(concreteComponentDescriptorProvider< - RNSVGFeGaussianBlurComponentDescriptor>()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add(concreteComponentDescriptorProvider< - RNSVGForeignObjectComponentDescriptor>()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add(concreteComponentDescriptorProvider< - RNSVGLinearGradientComponentDescriptor>()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add(concreteComponentDescriptorProvider< - RNSVGRadialGradientComponentDescriptor>()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); - registry->add( - concreteComponentDescriptorProvider()); -} - -} // namespace facebook::react diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h index 843df144e..61c44e7a6 100644 --- a/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h @@ -3,12 +3,9 @@ #include #include #include "RNSVGShadowNodes.h" -#include "RNSVGSvgViewShadowNode.h" namespace facebook::react { -using RNSVGSvgViewComponentDescriptor = - ConcreteComponentDescriptor; using RNSVGCircleComponentDescriptor = ConcreteComponentDescriptor; using RNSVGClipPathComponentDescriptor = @@ -64,7 +61,4 @@ using RNSVGTSpanComponentDescriptor = using RNSVGUseComponentDescriptor = ConcreteComponentDescriptor; -void rnsvg_registerComponentDescriptorsFromCodegena( - std::shared_ptr registry); - } // namespace facebook::react From a771b563496c4b7c42cb93b9b8ea997d7194a6d1 Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Fri, 6 Dec 2024 14:03:32 +0100 Subject: [PATCH 6/8] fix: remove useless constructor --- .../components/rnsvg/RNSVGConcreteShadowNode.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGConcreteShadowNode.h b/common/cpp/react/renderer/components/rnsvg/RNSVGConcreteShadowNode.h index 6ca0e9047..afbd565da 100644 --- a/common/cpp/react/renderer/components/rnsvg/RNSVGConcreteShadowNode.h +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGConcreteShadowNode.h @@ -24,17 +24,6 @@ class RNSVGConcreteShadowNode : public ConcreteShadowNode< StateData, false>; - RNSVGConcreteShadowNode( - const ShadowNodeFragment &fragment, - const ShadowNodeFamily::Shared &family, - ShadowNodeTraits traits) - : BaseShadowNode(fragment, family, traits) {} - - RNSVGConcreteShadowNode( - const ShadowNode &sourceShadowNode, - const ShadowNodeFragment &fragment) - : BaseShadowNode(sourceShadowNode, fragment) {} - using ConcreteViewProps = PropsT; using BaseShadowNode::BaseShadowNode; From ed6ecfe0f904e686cd00d6ba0e04660488c7b5c9 Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Fri, 6 Dec 2024 14:20:49 +0100 Subject: [PATCH 7/8] docs: add comment explaining why --- .../components/rnsvg/RNSVGLayoutableShadowNode.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp b/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp index cde2fc16e..35b955cf0 100644 --- a/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp @@ -8,6 +8,10 @@ RNSVGLayoutableShadowNode::RNSVGLayoutableShadowNode( const ShadowNodeFamily::Shared &family, ShadowNodeTraits traits) : YogaLayoutableShadowNode(fragment, family, traits) { + // SVG handles its layout manually on the native side and does not depend on + // the Yoga layout. Setting the dimensions to 0 eliminates randomly positioned + // views in the layout inspector when Yoga attempts to interpret SVG + // properties like width when viewBox scale isset. auto style = yogaNode_.style(); style.setDimension(yoga::Dimension::Width, yoga::value::points(0)); style.setDimension(yoga::Dimension::Height, yoga::value::points(0)); @@ -18,6 +22,10 @@ RNSVGLayoutableShadowNode::RNSVGLayoutableShadowNode( const ShadowNode &sourceShadowNode, const ShadowNodeFragment &fragment) : YogaLayoutableShadowNode(sourceShadowNode, fragment) { + // SVG handles its layout manually on the native side and does not depend on + // the Yoga layout. Setting the dimensions to 0 eliminates randomly positioned + // views in the layout inspector when Yoga attempts to interpret SVG + // properties like width when viewBox scale isset. auto style = yogaNode_.style(); style.setDimension(yoga::Dimension::Width, yoga::value::points(0)); style.setDimension(yoga::Dimension::Height, yoga::value::points(0)); From ce6aaf88afbec317abbcce8fc11849c2ab3bfc1b Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Fri, 6 Dec 2024 15:10:59 +0100 Subject: [PATCH 8/8] docs: fix typo Co-authored-by: Jakub Piasecki --- .../renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp b/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp index 35b955cf0..ab45296e1 100644 --- a/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp @@ -11,7 +11,7 @@ RNSVGLayoutableShadowNode::RNSVGLayoutableShadowNode( // SVG handles its layout manually on the native side and does not depend on // the Yoga layout. Setting the dimensions to 0 eliminates randomly positioned // views in the layout inspector when Yoga attempts to interpret SVG - // properties like width when viewBox scale isset. + // properties like width when viewBox scale is set. auto style = yogaNode_.style(); style.setDimension(yoga::Dimension::Width, yoga::value::points(0)); style.setDimension(yoga::Dimension::Height, yoga::value::points(0)); @@ -25,7 +25,7 @@ RNSVGLayoutableShadowNode::RNSVGLayoutableShadowNode( // SVG handles its layout manually on the native side and does not depend on // the Yoga layout. Setting the dimensions to 0 eliminates randomly positioned // views in the layout inspector when Yoga attempts to interpret SVG - // properties like width when viewBox scale isset. + // properties like width when viewBox scale is set. auto style = yogaNode_.style(); style.setDimension(yoga::Dimension::Width, yoga::value::points(0)); style.setDimension(yoga::Dimension::Height, yoga::value::points(0));