|
12 | 12 | #import "RNSVGGlyphContext.h" |
13 | 13 | #import "RNSVGGroup.h" |
14 | 14 |
|
| 15 | +#ifdef RCT_NEW_ARCH_ENABLED |
| 16 | +#import <react/renderer/components/rnsvg/ComponentDescriptors.h> |
| 17 | +using namespace facebook::react; |
| 18 | +#endif // RCT_NEW_ARCH_ENABLED |
| 19 | + |
15 | 20 | @interface RNSVGNode () |
16 | 21 | @property (nonatomic, readwrite, weak) RNSVGSvgView *svgView; |
17 | 22 | @property (nonatomic, readwrite, weak) RNSVGGroup *textRoot; |
@@ -264,16 +269,18 @@ - (void)setClientRect:(CGRect)clientRect |
264 | 269 | _clientRect = clientRect; |
265 | 270 | #ifdef RCT_NEW_ARCH_ENABLED |
266 | 271 | if (_eventEmitter != nullptr) { |
267 | | - facebook::react::LayoutMetrics customLayoutMetrics = _layoutMetrics; |
268 | | - customLayoutMetrics.frame.size.width = _clientRect.size.width; |
269 | | - customLayoutMetrics.frame.size.height = _clientRect.size.height; |
270 | | - customLayoutMetrics.frame.origin.x = _clientRect.origin.x; |
271 | | - customLayoutMetrics.frame.origin.y = _clientRect.origin.y; |
272 | | - _eventEmitter->onLayout(customLayoutMetrics); |
| 272 | + static_cast<const RNSVGGroupEventEmitter &>(*_eventEmitter) |
| 273 | + .onSvgLayout( |
| 274 | + {.layout = { |
| 275 | + .x = static_cast<int>(_clientRect.origin.x), |
| 276 | + .y = static_cast<int>(_clientRect.origin.y), |
| 277 | + .width = static_cast<int>(_clientRect.size.width), |
| 278 | + .height = static_cast<int>(_clientRect.size.height) |
| 279 | + }}); |
273 | 280 | } |
274 | 281 | #else |
275 | | - if (self.onLayout) { |
276 | | - self.onLayout(@{ |
| 282 | + if (self.onSvgLayout) { |
| 283 | + self.onSvgLayout(@{ |
277 | 284 | @"layout" : @{ |
278 | 285 | @"x" : @(_clientRect.origin.x), |
279 | 286 | @"y" : @(_clientRect.origin.y), |
@@ -660,7 +667,7 @@ - (void)prepareForRecycle |
660 | 667 | _fillBounds = CGRectZero; |
661 | 668 | _strokeBounds = CGRectZero; |
662 | 669 | _markerBounds = CGRectZero; |
663 | | - _onLayout = nil; |
| 670 | + _onSvgLayout = nil; |
664 | 671 |
|
665 | 672 | _svgView = nil; |
666 | 673 | _textRoot = nil; |
|
0 commit comments