Skip to content

feat(mobile): let TextIcon respect IconGlyphSourceContext overrides - #862

Open
adrienzheng-cb wants to merge 3 commits into
masterfrom
adrien/texticon-glyph-source-context
Open

feat(mobile): let TextIcon respect IconGlyphSourceContext overrides#862
adrienzheng-cb wants to merge 3 commits into
masterfrom
adrien/texticon-glyph-source-context

Conversation

@adrienzheng-cb

@adrienzheng-cb adrienzheng-cb commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

What changed? Why?

TextIcon hardcoded fontFamily: 'CoinbaseIcons' and read directly from the CDS glyphMap, bypassing the IconGlyphSourceContext that Icon (via createIcon) uses. This meant an IconGlyphSourceProvider — such as the one set up by retail-icons — had no effect on glyphs rendered by TextIcon.

Changes:

  • createIcon.tsx: export a useResolvedGlyph(boundSource, args) hook that wraps useContext(IconGlyphSourceContext) + the existing resolveGlyph logic. Also export IconGlyphSourceContext directly for consumers that need it.
  • createIcon.tsx: refactor the createIcon inner component to call useResolvedGlyph instead of inlining useContext + resolveGlyph.
  • TextIcon.tsx: call useResolvedGlyph with a module-level CDS bound source — same priority logic as Icon, no duplication, no second factory.
  • TextIcon.test.tsx: new test file with 6 cases covering the default CDS path, context override (glyph + font family), fallback when the context source doesn't cover the name, custom getGlyph resolver, and the missing-glyph null return.

UI changes

No visual change for existing usages — TextIcon without an IconGlyphSourceProvider in the tree behaves identically to before.

Testing

How has it been tested?

  • Unit tests

Testing instructions

Wrap a <TextIcon> in an <IconGlyphSourceProvider source={retailIconsSource}> and confirm the overridden glyph and font family are applied.

Change management

type=routine
risk=low
impact=sev5

automerge=false

TextIcon hardcoded 'CoinbaseIcons' and read directly from the CDS
glyphMap, bypassing the IconGlyphSourceContext used by Icon. This
meant retail-icons (and any other IconGlyphSourceProvider) had no
effect on TextIcon glyphs.

- Export IconGlyphSourceContext from createIcon so TextIcon can access it
- Resolve context source first (same priority logic as createIcon/resolveGlyph),
  falling back to the CDS glyphMap when the context source doesn't cover the name
- Apply the resolved fontFamily instead of hardcoding 'CoinbaseIcons'
- Add TextIcon.test.tsx with 6 cases covering the override and fallback paths

Co-authored-by: Cursor <cursoragent@cursor.com>
@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
CODEOWNERS 🟡 See below

🟡 CODEOWNERS

Code Owner Status Calculation
ui-systems-eng-team 🟡 0/1
Denominator calculation
Additional CODEOWNERS Requirement
Show calculation
Sum 0
0
From CODEOWNERS 1
Sum 1

Comment thread packages/mobile/src/icons/TextIcon.tsx Outdated
hcopp
hcopp previously approved these changes Aug 26, 2026
@cb-heimdall

Copy link
Copy Markdown
Collaborator

Review Error for hcopp @ 2026-08-26 16:20:02 UTC
User failed mfa authentication, either user does not exist or public email is not set on your github profile. \ see go/mfa-help

…c between Icon and TextIcon

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants