docs(native-list): add the shared style spec and drop dead web CSS - #107
Open
huhuanming wants to merge 1 commit into
Open
huhuanming wants to merge 1 commit into
huhuanming wants to merge 1 commit into
Conversation
Add docs/STYLE_SPEC.md as the style vocabulary for rows, section headers, fixed footers, and empty states. The three renderers cannot constrain each other, so the spec is authoritative by review plus the one boundary they share: the serialized snapshot. It records the design tokens aliased to the application's own token names, the per-template style surface keyed by model field rather than by view (metricCard renders its value through the title label, so view names mis-target), list chrome, the template isolation rules, and a review checklist. Cross-platform divergences are registered, not changed: the three row-height tables disagree (rail 40/28/40, sectionHeader summary 68/80/68), Android draws sticky headers through a second renderer with its own typography, section headers carrying a value or a checkbox silently lose stickiness on Android, and source scale is computed list-wide. Remove dead duplicated rules from WEB_LIST_CSS: four blocks were emitted twice and a prefers-reduced-motion block three times, and every property of the earlier copies was redeclared by the later ones, so removing them changes no rendering. The two oddities that look like duplication are load-bearing and are documented instead - the !important on the account action row overrides an inline radius, and the market change chip's literal colors do not equal their nearest tokens. Also apply prettier to NativeList.web.test.ts, which was left unformatted by d91262e and failed lint before this change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
P0 of the row-style work: establish the shared style vocabulary as a document, and clear the dead style overrides that would otherwise be copied forward.
No rendering values change in this PR.
Why
NativeList serves 13 row templates from one shared view pool per platform, and each template hard-codes its own typography and geometry in three separate renderers. Only
marketaccepts astyleobject today; every other template is tuned by adding apresentationvariant plus a branch in each renderer.Two vocabularies have drifted far enough to be a problem on their own:
text↔primaryText,textSubdued↔secondaryText,borderSubdued↔separator— and the application'siconActivemaps onto the key namedaccent. Every consumer writes the mapping by hand.$bodyMdis used 2,418 times across the app,$bodySm1,735,$bodyLg791) while the list uses ten-plus bare font sizes and references the scale nowhere. "One step smaller" has no shared meaning between design and this component.What is in
docs/STYLE_SPEC.mdvalidation.ts, so the native renderers never learn the vocabulary and cannot drift from it. Everything else is review.Why keys are named after model fields
All three platforms share one view pool and the mapping is not one-to-one:
metricCardrenders its value through the title label and its title through the subtitle label; the status label carriesrail.status,activity.status,message.time, andmetricCard.trend. Naming style keys after views would mis-target.marketalready follows this rule withstyle.price/style.change.Divergences registered, not changed
The row-height tables are deliberately left alone — the values may have been tuned per platform on real devices, and changing them without device verification would be guesswork:
railactivity+ footer actionsdataRow+ secondary textsectionHeadersummarysectionHeadervalue + checkboxAlso registered in §6:
StickySectionHeaderDecorationusescanvas.drawTextwith its ownPaint, font sizes, hard-coded semibold typeface, height, inset, manual letter spacing and baseline math. iOS pins the real cell and Web reusesrenderElement, so both inherit row styling for free.isSimpleStickySectionHeader). Needs a product decision.usesSelectorSourceScaleis computed withitems.any { … }, so one selector row switches the sub-400dp metric system for the entire list.Cleanup
Removed dead duplicated rules from
WEB_LIST_CSS: four blocks were emitted twice and aprefers-reduced-motionblock three times, and every property of the earlier copies was redeclared by the later ones, so removing them changes no rendering.Deliberately not removed, documented in §6.4 instead — both look like duplication but are load-bearing:
.ok-native-list-account-action-row .ok-native-list-visual{border-radius:8px!important}— the!importantoverrides an inline radius written bycreateVisual. Removing it regresses the account action row to 10px..ok-native-list-market-change{color:#fff;background:#8d8d8d}— literals rather than tokens because--nl-inverse-textdefaults to#fcfcfcand--nl-secondaryto#6b7280. Swapping them changes untinted rendering.Drive-by:
src/__tests__/NativeList.web.test.tswas left unformatted by d91262e and failedeslint; prettier applied.Base branch
Targets
codex/ok-50498-android-theme-icons, notmain— thereact-native-native-listpackage does not exist onmain.Verification
jest— 5 suites, 68 tests, all passtsc -b— cleaneslint— clean (9 errors before the prettier fix, all pre-existing)Next
P1 (contract plus Web implementation), P2 (iOS and Android), P3 (list chrome and an example page) follow as separate PRs. This spec is the input to all three.
🤖 Generated with Claude Code