Skip to content

fix(hex): Android crash — drop RadialGradient + SvgText fontFamily#68

Merged
andrlut merged 1 commit into
mainfrom
fix/hex-android-svg-text
May 3, 2026
Merged

fix(hex): Android crash — drop RadialGradient + SvgText fontFamily#68
andrlut merged 1 commit into
mainfrom
fix/hex-android-svg-text

Conversation

@andrlut

@andrlut andrlut commented May 3, 2026

Copy link
Copy Markdown
Owner

Summary

PR #67's userSpaceOnUse + numeric-coords fix didn't stop the Android crash. Research surfaced two known react-native-svg 15.12.1 Android bugs we were still hitting:

  1. Brush.getVal() NPE on RadialGradient (software-mansion/react-native-svg#2940) — native UI thread reads cx/cy/r before SVGLength resolves → null deref → instant crash. iOS pipeline is different and unaffected.
  2. SvgText fontFamily lookup vs native Android typefaces — expo-font registers fonts with RN's Text layer, but react-native-svg's native Android renderer reads from assets/fonts and can crash on a miss.

Fix

  • Removed RadialGradient + Defs/Stop imports entirely. Score polygon now fills with a flat rgba(155,130,255,0.28). Same color family, no gradient — eliminates the NPE source.
  • Dropped fontFamily="Manrope_800ExtraBold" from every <SvgText>. Kept fontWeight="800" so labels still feel heavy; system sans-serif is close enough for the chart's small text.

Re-adding later

Both can come back when:

  • The Brush.getVal null guard from PR #2940 lands (or we patch-package it ourselves)
  • We expose Manrope as an asset-registered typeface that the SVG native renderer can find

Tracking as a follow-up. For now the Hero opens, which is what matters.

Test plan

  • Open Hero on Android — no crash
  • Hex shows the 6-vertex polygon with the violet flat fill
  • Numbers in the vertex discs and the center "5.7" still readable
  • Open self-assessment modal — works, scoring still saves

🤖 Generated with Claude Code

@andrlut andrlut merged commit 53d47c6 into main May 3, 2026
2 checks passed
@andrlut andrlut deleted the fix/hex-android-svg-text branch May 3, 2026 13:01
…tigations

Hero kept crashing on Android even after PR #67's userSpaceOnUse fix.
Two known react-native-svg 15.12.1 Android bugs were still being hit:

  1. Brush.getVal() NPE on RadialGradient (issue #2940). The native UI
     thread reads cx/cy/r before SVGLength is resolved → null deref →
     instant crash. iOS path is different and unaffected.
     → Removed the radial gradient entirely. Polygon now uses a flat
     semi-transparent violet fill. Same visual class, zero crash risk.

  2. SvgText `fontFamily` lookup against native typeface assets. Fonts
     loaded via expo-font (e.g. "Manrope_800ExtraBold") register with
     RN's Text layer but aren't always resolvable by react-native-svg's
     native Android renderer.
     → Dropped fontFamily from every SvgText. Kept fontWeight="800" so
     the labels stay heavy. System sans-serif is close enough.

Re-add the gradient and custom font once the upstream Brush.getVal
guard lands and we have a font-asset-registration solution for SVG
text on Android.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant