react-native-svg: -[RNSVGRenderable renderLayerTo:rect:] | Fatal Exception: CALayerInvalidGeometry | CALayer bounds contains NaN: [0 0; nan nan]

Hello,

I got this error:

Fatal Exception: CALayerInvalidGeometry CALayer bounds contains NaN: [0 0; nan nan]

Stack:

Fatal Exception: CALayerInvalidGeometry
0  CoreFoundation                 0x1cb045ea4 __exceptionPreprocess
1  libobjc.A.dylib                0x1ca215a50 objc_exception_throw
2  CoreFoundation                 0x1caf4c484 -[NSCache init]
3  QuartzCore                     0x1cf64bbdc CA::Layer::set_bounds(CA::Rect const&, bool)
4  QuartzCore                     0x1cf63c024 -[CALayer setBounds:]
5  UIKitCore                      0x1f87be624 -[UIView(Geometry) setBounds:]
6  app                       0x102c802a8 -[RNSVGRenderable renderLayerTo:rect:]
7  app                       0x102c7fd90 -[RNSVGRenderable renderTo:rect:]
8  app                       0x102c81a38 __33-[RNSVGGroup renderGroupTo:rect:]_block_invoke
9  app                       0x102c85720 -[RNSVGNode traverseSubviews:]
10 app                       0x102c816b8 -[RNSVGGroup renderGroupTo:rect:]
11 app                       0x102c7fd90 -[RNSVGRenderable renderTo:rect:]
12 app                       0x102c81a38 __33-[RNSVGGroup renderGroupTo:rect:]_block_invoke
13 app                       0x102c85720 -[RNSVGNode traverseSubviews:]
14 app                       0x102c816b8 -[RNSVGGroup renderGroupTo:rect:]
15 app                       0x102c7fd90 -[RNSVGRenderable renderTo:rect:]
16 app                       0x102c978d0 -[RNSVGSvgView drawToContext:withRect:]
17 app                       0x102c97bc8 -[RNSVGSvgView drawRect:]
18 UIKitCore                      0x1f87d8da4 -[UIView(CALayerDelegate) drawLayer:inContext:]
19 QuartzCore                     0x1cf64170c -[CALayer drawInContext:]
20 QuartzCore                     0x1cf522ca8 CABackingStoreUpdate_
21 QuartzCore                     0x1cf64828c invocation function for block in CA::Layer::display_()
22 QuartzCore                     0x1cf640fc4 -[CALayer _display]
23 QuartzCore                     0x1cf5a5668 CA::Context::commit_transaction(CA::Transaction*)
24 QuartzCore                     0x1cf5d3ec8 CA::Transaction::commit()
25 QuartzCore                     0x1cf5d4d30 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
26 CoreFoundation                 0x1cafd56bc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
27 CoreFoundation                 0x1cafd0350 __CFRunLoopDoObservers
28 CoreFoundation                 0x1cafd0100 CFRunLoopRunSpecific
29 GraphicsServices               0x1cd249584 GSEventRunModal
30 UIKitCore                      0x1f8330c00 UIApplicationMain
31 app                       0x102a8bc88 main (main.m:14)
32 libdyld.dylib                  0x1caa8ebb4 start

RN Version: 0.59.0 RN Svg Version: 9.3.3 iOS version: 12.1.4

Thanks for this awesome lib \o/

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 15

Most upvoted comments

Have the same error on IOS 10

In my case it was because I had some elements that were of 0 width or height (pretty sure the whole SVG was actually), or I was passing NaN as one of the numeric values accidentally.