diff --git a/android/src/main/jni/rnsvg.h b/android/src/main/jni/rnsvg.h index 82c748cf..032cecfc 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/apple/Elements/RNSVGClipPath.mm b/apple/Elements/RNSVGClipPath.mm index 375d1176..b37dac61 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 00cea30c..6300c1a3 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 7b8b531f..31e5a5c5 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 f62c11de..543fcf83 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 0da30060..ffaae200 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 0944a2f4..bd026400 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 6a1fba93..f5abdec2 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 25f9e11d..c85a78a5 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 ace93c8c..d43992ed 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 bfbf971b..589ef053 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 831fc302..b1fbd4a6 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 9a2d2d2d..a8e9bc4e 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 00928a40..95966e95 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 a8fd5226..826b2617 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 2195726d..d414a4d4 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 75cff49f..63ed92e1 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 3361352f..4fa00c9c 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 7dc200a9..5ea542d1 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 ca236e04..df4fb252 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 0e8889ee..6edb4d2c 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 195bc48a..9dbd5dba 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 96e07360..29ed3309 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 0827faf5..9da51641 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 e091ee60..79d0a7e6 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 dc84611e..e98ff870 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 5f3039eb..2e06de34 100644 --- a/apple/Text/RNSVGTSpan.mm +++ b/apple/Text/RNSVGTSpan.mm @@ -20,8 +20,8 @@ static CGFloat RNSVGTSpan_radToDeg = 180 / (CGFloat)M_PI; #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 8dc81f98..42cfe22c 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 c37c082d..a6296d73 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 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 00000000..61c44e7a --- /dev/null +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGComponentDescriptors.h @@ -0,0 +1,64 @@ +#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; + +} // 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 00000000..afbd565d --- /dev/null +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGConcreteShadowNode.h @@ -0,0 +1,59 @@ +#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>; + + 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 00000000..ab45296e --- /dev/null +++ b/common/cpp/react/renderer/components/rnsvg/RNSVGLayoutableShadowNode.cpp @@ -0,0 +1,42 @@ +#include "RNSVGLayoutableShadowNode.h" +#include + +namespace facebook::react { + +RNSVGLayoutableShadowNode::RNSVGLayoutableShadowNode( + const ShadowNodeFragment &fragment, + 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 is set. + 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) { + // 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 is set. + 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 00000000..968b1bff --- /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 00000000..70f1abd4 --- /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 00000000..71addc84 --- /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 diff --git a/src/fabric/CircleNativeComponent.ts b/src/fabric/CircleNativeComponent.ts index 05189a56..09ec6df5 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 8dfdc7e3..d9c79ca4 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 cf517b1a..b0392a9d 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 5b306a50..4773f831 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 67c0d722..ceca9f44 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 62f167d2..6f0ed781 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 bdf2041a..1ea51238 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 82d2b68e..ae6fa8e7 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 440a0bba..87fd3da2 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 5dba04d3..a7741d73 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 403845ee..d52833d7 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 11066d07..2cabcd26 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 ada2fa89..2acdb034 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 db52f140..d509b844 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 4ee24312..ab0e45ad 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 ee39834d..7b1d39c6 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 57c004be..a258d457 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 33c96f64..dac11a35 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 b42518b7..5520ae18 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 be066934..014458a7 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 6a0ca935..52409b04 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 7a3a091a..9d8f37ba 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 7a1fceea..dde02a57 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 99e7de99..1e85f40b 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 62d50c70..539b228b 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 401b2e89..e6d63076 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 bb5d7996..e1e01bb5 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, +});