Skip to content

Conversation

@georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Dec 2, 2025

See slack thread for test builds of this PR

Description

This PR implements expo-font to improve font rendering and maintainability of fonts in MetaMask Mobile. The change provides several benefits:
(from docs)

  1. Fonts are available immediately when the app starts on a device.
  2. No additional code required to load fonts in a project asynchronously when the app starts.
  3. Fonts are consistently available across all devices where the app is installed because they're bundled within the app.

Key Changes

  • Added expo-font plugin configuration in app.config.js with all app fonts
  • Updated font family naming convention from space-separated (e.g., "Geist Regular") to hyphenated (e.g., "Geist-Regular") for better compatibility
  • Updated snapshots to reflect font family name changes

Review and Merge Strategy

Snapshot Management Approach:

This PR updates font file names and font family definitions, which will trigger a large number of snapshot updates. To reduce the risk of the PR becoming outdated, I've adopted the following strategy:

  1. Separated Concerns
    All fixes owned by teams outside of @metamask-design-system-team and @mobile-platform have been moved to a separate PR: fix: update MM Sans and MM Poly fonts to use PostScript names #23650

  2. Combined Build for Testing
    A build that includes changes from both PRs is available in this Slack thread for end-to-end testing.

  3. Phased Review Process

    • Phase 1 (Current): Seeking approvals from QA, Mobile Platform, and Design System teams on core logic changes without snapshot updates
    • Phase 2 (After Approval): Once approvals are received, snapshot updates will be pushed
    • Phase 3 (Final Review): Re-review focused only on snapshot changes

Benefits of This Approach:

Remaining Work:

  • Obtain approvals from QA, Mobile Platform, and Design System teams
  • Push snapshot updates (pending approvals)
  • Final review and merge

Changelog

CHANGELOG entry: Fixes intermittent font rendering issues on first load of the app or import of SRP

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MDP-603

Manual testing steps

Feature: Font rendering with expo-font

  Scenario: user views app with new font system
    Given the app is running with expo-font enabled
    
    When user navigates through various screens
    Then all fonts should render correctly without font family, font weight or text cut off issues
    And font weights and styles should be consistent across the app

Screenshots/Recordings

Before

No before recordings, I can't seem to reproduce the font loading issues but they exist see slack thread

After

All fonts rendering as expected. No incorrect font weights, system fonts (incorrect font family), or cut-off text. Below screen recordings and screenshots of this PR and fast follow PR combined in build

iOS

ios.after.mov

Key screens:

  • MM Sans & MM Poly working
  • Tabs built with @metamask/design-system-react-native working
Screenshot 2025-12-10 at 8 41 08 AM Screenshot 2025-12-10 at 8 41 14 AM Screenshot 2025-12-10 at 8 41 23 AM

Android

expo.font.android.build.mov

Key screens:

  • MM Sans & MM Poly working
  • Tabs built with @metamask/design-system-react-native working
Screenshot 2025-12-10 at 8 31 02 AM Screenshot 2025-12-10 at 8 31 06 AM Screenshot 2025-12-10 at 8 30 33 AM

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Integrates Expo Font and standardizes font family names, updating snapshots across the app.

  • Fonts:
    • Add expo-font configuration in app.config.js to bundle/load fonts at startup.
    • Rename font families from space-separated to hyphenated (e.g., Geist RegularGeist-Regular).
  • Tests:
    • Refresh widespread snapshots to reflect new fontFamily values; no functional UI changes.

Written by Cursor Bugbot for commit fc68231. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-design-system All issues relating to design system in Mobile label Dec 2, 2025
@georgewrmarshall georgewrmarshall self-assigned this Dec 2, 2025
@github-actions github-actions bot added the size-M label Dec 2, 2025
@socket-security
Copy link

socket-security bot commented Dec 2, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​metamask/​design-system-react-native@​0.4.0 ⏵ 0.5.099 +210083 +291 -3100
Updatednpm/​expo-build-properties@​0.13.2 ⏵ 0.13.310010084 +1100 +1100
Updatednpm/​@​metamask/​design-system-twrnc-preset@​0.2.1 ⏵ 0.3.0100 +110010090 +8100

View full report

@socket-security
Copy link

socket-security bot commented Dec 2, 2025

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring alerts on:

View full report

Copy link
Contributor Author

@georgewrmarshall georgewrmarshall Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally expo-font handles copying the font files to the android/ folder as apart of the pre-build process but because we aren't using expo to build the ios/ and android/ folders yet we have to manually add these as per the docs

Image

Copy link
Contributor Author

@georgewrmarshall georgewrmarshall Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

export const fontStyles: Record<string, TextStyle> = {
normal: {
fontFamily: 'Geist Regular',
fontFamily: 'Geist-Regular',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating fontStyles to match Post Script font family name

},
optionsContainer: { flexDirection: 'row', marginTop: 14 },
option: { alignItems: 'center', paddingHorizontal: 14 },
optionIcon: { fontSize: 24 },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will create other PRs to reduce all static font-family definitions

import NavigationProvider from '../../Nav/NavigationProvider';
import ControllersGate from '../../Nav/ControllersGate';
import { isTest } from '../../../util/test/utils';
import FontLoadingGate from './FontLoadingGate';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing custom font preloader from Root. Will need to completely remove in a separate PR

/>,
);

const textElement = getByText(/ETH/);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be refactored to not use static font family name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the expo-font docs renaming font files that match the PostScript name

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Comment on lines -28 to +30
const italicSuffix = resolvedStyle === 'italic' ? ' Italic' : '';
const italicSuffix = resolvedStyle === 'italic' ? 'Italic' : '';

return `Geist ${fontSuffix}${italicSuffix}`;
return `Geist-${fontSuffix}${italicSuffix}`;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing spaces and adding dash - to match font file renaming and postscript names

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostScript name in Font Book

Image

brianacnguyen
brianacnguyen previously approved these changes Dec 10, 2025
brianacnguyen
brianacnguyen previously approved these changes Dec 10, 2025
Cal-L
Cal-L previously approved these changes Dec 10, 2025
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

georgewrmarshall and others added 3 commits December 11, 2025 07:03
CI environment generates Podfile.lock checksums that match main branch.
Using main's Podfile.lock to avoid CI 'working tree dirty' errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeCore, SmokeWalletPlatform
  • Risk Level: medium
  • AI Confidence: 75%
click to see 🤖 AI reasoning details

This PR implements a font naming convention change from space-separated ("Geist Regular") to hyphen-separated ("Geist-Regular") format across the entire application.

Key changes:

  1. Text.utils.ts - Modified getFontFamily() function to return hyphen-separated font names (e.g., "Geist-Medium" instead of "Geist Medium")
  2. app.config.js - Added expo-font plugin with explicit font paths
  3. Android font assets renamed and link-assets-manifest.json updated
  4. 90+ snapshot files updated to reflect new font family names

Risk assessment:

  • Medium risk because this affects typography rendering app-wide
  • The change is systematic through Text.utils.ts, so the core change is small and contained
  • However, there are some hardcoded font names in other files that weren't updated (potential visual bugs)
  • E2E tests don't directly test fonts, but broken font loading would cause rendering issues detectable by visual tests

Selected tags rationale:

  • SmokeCore: Tests core wallet functionality and app state - will verify basic rendering works
  • SmokeWalletPlatform: Tests core wallet and account features - broad coverage to catch any font-related rendering issues

Not all tags needed because font issues would manifest similarly across all areas - if core functionality renders correctly with proper fonts, other areas will too.

View GitHub Actions results

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.81%. Comparing base (27e7f2e) to head (fc68231).
⚠️ Report is 64 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23517      +/-   ##
==========================================
+ Coverage   78.73%   78.81%   +0.08%     
==========================================
  Files        4042     4051       +9     
  Lines      105606   106197     +591     
  Branches    21267    21454     +187     
==========================================
+ Hits        83144    83699     +555     
+ Misses      16637    16615      -22     
- Partials     5825     5883      +58     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud
Copy link

Copy link
Contributor

@smilingkylan smilingkylan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

@georgewrmarshall georgewrmarshall added this pull request to the merge queue Dec 10, 2025
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Merged via the queue into main with commit 246bc9c Dec 10, 2025
112 checks passed
@georgewrmarshall georgewrmarshall deleted the fix-expo-font branch December 10, 2025 19:19
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2025
@metamaskbot metamaskbot added the release-7.62.0 Issue or pull request that will be included in release 7.62.0 label Dec 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.62.0 Issue or pull request that will be included in release 7.62.0 size-M team-design-system All issues relating to design system in Mobile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants