/** * Copyright (c) 2015-present, Horcrux. * All rights reserved. * * This source code is licensed under the MIT-style license found in the * LICENSE file in the root directory of this source tree. */ #import "RNSVGClipPath.h" #ifdef RCT_NEW_ARCH_ENABLED #import #import #import #import #import "RNSVGFabricConversions.h" #endif // RCT_NEW_ARCH_ENABLED @implementation RNSVGClipPath #ifdef RCT_NEW_ARCH_ENABLED using namespace facebook::react; - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { static const auto defaultProps = std::make_shared(); _props = defaultProps; } return self; } #pragma mark - RCTComponentViewProtocol + (ComponentDescriptorProvider)componentDescriptorProvider { return concreteComponentDescriptorProvider(); } - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps { const auto &newProps = *std::static_pointer_cast(props); setCommonNodeProps(newProps, self); _props = std::static_pointer_cast(props); } - (void)prepareForRecycle { [super prepareForRecycle]; } #endif // RCT_NEW_ARCH_ENABLED - (void)parseReference { self.dirty = false; [self.svgView defineClipPath:self clipPathName:self.name]; } - (BOOL)isSimpleClipPath { NSArray *children = self.subviews; if (children.count == 1) { RNSVGView *child = children[0]; if ([child class] != [RNSVGGroup class]) { return true; } } return false; } @end #ifdef RCT_NEW_ARCH_ENABLED Class RNSVGClipPathCls(void) { return RNSVGClipPath.class; } #endif // RCT_NEW_ARCH_ENABLED