Repository navigation
Description
Description
On iOS (Fabric), a view with borderRadius and an outset boxShadow containing a negative spread logs CoreGraphics invalid numeric value (NaN) errors whenever its size is zero — e.g. the first frame of a measure-then-animate tab indicator, before measurement resolves its width. This is a natural transient state for any animated indicator, not invalid input.
Root cause in RCTGetOutsetBoxShadowLayer (React/Fabric/Utils/RCTBoxShadow.mm):
CGRect shadowRect = CGRectInset(shadowLayer.bounds, -shadow.spreadDistance, -shadow.spreadDistance);With zero bounds and negative spread, the inset yields negative dimensions, so CGRectInset returns CGRectNull (origin = infinity). The null rect is passed unchecked into RCTPathCreateWithRoundedRect → RCTPathAddEllipticArc → CGPathAddArc, producing NaN. Each mount logs 8 errors = 2 paths (shadowPath + padded mask path) × 4 corner arcs, from the negative-spread layer only.
This is a regression introduced in 0.80.0 by #50636 ("Use CA shadow apis for box shadow", commit 52173ab). The previous implementation clamped the shadow rect size (v0.79.0, RCTBoxShadow.mm L133):
CGSize shadowRectSize = CGSizeMake(fmax(layerSize.width + 2 * spreadDistance, 0),
fmax(layerSize.height + 2 * spreadDistance, 0));The rewrite dropped the clamp (v0.80.0, L81). Note the inset branch of the same file guards with CGRectIsNull (L123); the outset branch does not.
Impact: log noise only — CG ignores the invalid values and the view is invisible on that frame anyway. Android is unaffected: RectF.inset keeps finite values and Skia silently skips empty rects.
Real-world trigger: any indicator styled with Tailwind shadow-sm (0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1) — second layer has spread −1px).
Reproduced via Expo Go (Expo SDK 58, RN 0.88); the reproducer code is pure React Native with no Expo APIs — this is an RN core defect.
Steps to reproduce
- Open the reproducer Snack below in Expo Go on an iOS simulator (or paste its
App.jsinto any RN 0.80+ app). - Capture system logs:
xcrun simctl spawn booted log stream --predicate 'eventMessage CONTAINS "CoreGraphics"'. - Observe 8 CoreGraphics NaN errors on mount; tap Unmount → Mount to re-fire.
- Remove the negative spread (or the shadow) from the style → zero errors.
React Native Version
0.88.1(regression introduced in 0.80.0; 0.79.x unaffected)
Affected Platforms
Runtime - iOS, Build - MacOS
Areas
Fabric - The New Renderer
Output of npx @react-native-community/cli info
System:
OS: macOS 27.2
CPU: (10) arm64 Apple M4
Memory: 118.67 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 24.15.0
path: /Users/techzealot/Library/pnpm/node
Yarn: Not Found
npm:
version: 11.12.1
path: /Users/techzealot/Library/pnpm/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.17.0
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 27.2
- iOS 27.2
- macOS 27.2
- tvOS 27.2
- visionOS 27.2
- watchOS 27.2
Android SDK: Not Found
IDEs:
Android Studio: 2026.2 AI-262.10968.63.2622.16840690
Xcode:
version: 27.2/27B52
path: /usr/bin/xcodebuild
Languages:
Java:
version: 21.0.6
path: /usr/bin/javac
Ruby:
version: 4.0.10
path: /opt/homebrew/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 19.3.0
wanted: 19.3.0
react-native:
installed: 0.88.1
wanted: 0.88.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
Error: this application, or a library it uses, has passed an invalid numeric value (NaN,
or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem.
Backtrace (captured with CG_NUMERICS_SHOW_BACKTRACE=1):
_CGPathAddArc + 148
RCTPathAddEllipticArc + 428
RCTPathCreateWithRoundedRect + 2244
RCTGetOutsetBoxShadowLayer
RCTGetBoxShadowLayer
-[RCTViewComponentView invalidateLayer]
-[RCTViewComponentView traitCollectionDidChange:]
MANDATORY Reproducer
https://snack.expo.dev/@techzealot/box-shadow
Screenshots and Videos
No response
Activity