Skip to content

feat(docs): update docs about fonts + proguard rules - #1479

Merged
dannyhw merged 3 commits into
callstack:mainfrom
CristiCeban:docs/android-font-assets
Oct 9, 2026
Merged

dannyhw merged 3 commits into
callstack:mainfrom
CristiCeban:docs/android-font-assets

Conversation

@CristiCeban

Copy link
Copy Markdown
Contributor

Follow-up to #1473. Two small changes found while testing 5.4.1-canary-20261005140324 on a React Native 0.87 app that uses React Native Skia:

1. Docs: Android asset output and fonts

  • api/loaders/assets-loader.md said Android assets go only to drawable-*. In release builds they actually go to drawable-*, font or raw depending on type. Since fix: support Android font assets in Skia #1473, font files are written to both font and raw, and raw/keep.xml is generated. I added a table of where each asset type goes, explained why fonts are written twice and what keep.xml is for, and noted that dev-server builds and remote assets don't use this layout.
  • New guide docs/guides/fonts.md:
    • Loading fonts from JS (e.g. Skia useFont(require(...))): works without setup.
    • Native <Text fontFamily>: React Native doesn't look up fonts in res/font by itself. Link fonts natively (recommended), or register the Re.Pack-emitted resource with ReactFontManager.addCustomFont (release builds only).
    • .ttc: not in the default asset extensions, so it needs an extra loader rule.

2. Android: consumer R8 rules

With minifyEnabled true, release builds of apps using Re.Pack fail:

ERROR: R8: Missing class com.google.errorprone.annotations.CanIgnoreReturnValue
(referenced from: com.nimbusds.jose.shaded.gson.GsonBuilder ...)

The Gson copy bundled inside nimbus-jose-jwt (used for code signing, bumped to 10.8 in #1358) references Error Prone annotations, which are only needed at compile time. Re.Pack ships no consumer R8 rules, so each app currently has to add a -dontwarn itself. This PR adds android/consumer-rules.pro with -dontwarn com.google.errorprone.annotations.** and wires it up through consumerProguardFiles, so R8 builds work without app changes.

Alternative: document the rule for users to add (as requested in #1198). Shipping it with the library seemed better because it fixes the build for everyone without extra setup.

Not included: the Gson TypeToken keep rules for code signing from #1198. They weren't tested with R8 here, and they would need to target the shaded package (com.nimbusds.jose.shaded.gson).

Test plan

Test app: RN 0.87.1, @callstack/repack@5.4.1-canary-20261005140324, @shopify/react-native-skia@2.14.0, with TTF, OTF and TTC fonts loaded through Skia useFont(require(...)) and native <Text fontFamily>.

R8 consumer rules (Android release, minifyEnabled true + shrinkResources true)

Re.Pack android/build.gradle Result
Canary as published ❌ Missing class com.google.errorprone.annotations.CanIgnoreReturnValue
Canary + consumerProguardFiles "consumer-rules.pro" ✅ Builds, app runs, all fonts load

The app had no -dontwarn rules of its own in either run.

Docs

  • pnpm build in website/ succeeds with no broken-link warnings.
  • /docs/guides/fonts renders and appears in the Guides sidebar.
  • The links between the fonts guide and /api/loaders/assets-loader#android-resource-directories, and to /api/utils/constants#asset_extensions, resolve.
  • The fonts guide is based on behavior checked in the test app:
    • Android: release build with shrinking checked on an emulator, debug build with the dev server.
    • iOS: iOS 27 simulator, release and debug.
    • Skia loads fonts in all of these.
    • Native <Text>: natively linked fonts render in all builds; addCustomFont with the Re.Pack font resource works in Android release only.

@vercel

vercel Bot commented Oct 8, 2026

Copy link
Copy Markdown

@CristiCeban is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 65ed637

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@callstack/repack Patch
@callstack/repack-plugin-expo-modules Patch
@callstack/repack-plugin-nativewind Patch
@callstack/repack-plugin-reanimated Patch
@callstack/repack-dev-server Patch
@callstack/repack-init Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread website/src/latest/api/loaders/assets-loader.md Outdated
Comment thread website/src/latest/api/loaders/assets-loader.md Outdated
Comment thread website/src/latest/docs/guides/fonts.md Outdated
Comment thread website/src/latest/docs/guides/fonts.md
@dannyhw
dannyhw merged commit 811a6d8 into callstack:main Oct 9, 2026
1 check failed
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.

2 participants