Skip to content

docs: fix inaccurate readme claims and document bundle size - #91

Merged
duongdev merged 1 commit into
mainfrom
docs/readme-accuracy
Aug 10, 2026
Merged

docs: fix inaccurate readme claims and document bundle size#91
duongdev merged 1 commit into
mainfrom
docs/readme-accuracy

Conversation

@duongdev

Copy link
Copy Markdown
Owner

Verified every claim against the published phosphor-react-native@3.0.6, the react-native-svg source, and tsc --strict --skipLibCheck false.

Tree-shaking claim (closes the README part of #61)

The README promised "Phosphor supports tree-shaking, so your bundle only includes code for the icons you use". Metro does not tree-shake by default, and the benchmark from #88 shows the barrel import costs +182% vs +10% for a direct import. Replaced with a Bundle size section carrying those numbers, plus the two real fixes: direct imports, or Expo's experimental tree-shaking.

Fixes

  • Deep import path. phosphor-react-native/lib/commonjs/icons/Star is not in the exports map — it fails with ERR_PACKAGE_PATH_NOT_EXPORTED on any resolver honouring exports, which Metro does by default since RN 0.79. Removed; documented src/icons/* and its naming rule.
  • TypeScript snippet did not compile. interface SvgProps extends DefaultSvgProps is self-recursive (TS2310) and DefaultIconProps was never imported (TS2304). Rewritten as plain module augmentation, with a note on why extends is wrong. Same bug fixed in global.d.ts.
  • Props. Dropped "accepts all SVG props, including onClick" — IconProps is closed and RN has no onClick. Corrected the size-unit list: react-native-svg runs parseInt, so "2rem" is 2, not 32. Corrected duotoneColor, which falls back to color, not black. Added the missing style prop and per-prop defaults.
  • Migrating from v2. Documents the Icon suffix, and that Circle / Path / Infinity have no deprecated alias (1509 of 1512 do).
  • Context. Lists which props are context-able and their defaults.
  • Related Projects. All eight repos have been renamed upstream (phosphor-react -> phosphor-icons/react, phosphor-icons -> web, and so on).
  • Added badges, icon count, a Contributing section with the git submodule update --init --recursive step, and links to CONTRIBUTING.md and example/.

Verification

Every documented snippet typechecks against the published package under --strict with skipLibCheck: false — including size="50%", the duotone props, className after augmentation, and the src/icons/Star deep import. No formatting-only changes: the README was already not Prettier-clean on main, and yarn lint covers src/** only.

Noted, not fixed here

src/lib/icon-base.tsx:48-49 uses the raw weight prop instead of weight ?? contextWeight, so an icon rendered without an explicit weight gets testID="phosphor-react-native-star-undefined" and a matching className. Worth its own PR — I worded the README around it rather than documenting a wrong default.

@duongdev
duongdev merged commit 93fa60d into main Aug 10, 2026
2 checks passed
@duongdev
duongdev deleted the docs/readme-accuracy branch August 10, 2026 10:41
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