Skip to content

feat(example): add the Native List Row Style page - #111

Open
huhuanming wants to merge 1 commit into
codex/native-list-row-style-nativefrom
codex/native-list-row-style-example
Open

huhuanming wants to merge 1 commit into
codex/native-list-row-style-nativefrom
codex/native-list-row-style-example

Conversation

@huhuanming

Copy link
Copy Markdown
Contributor

Stacked on #110#109#107. This PR's diff is P3 only.

What

The Native List Row Style example page, plus a DESIGN.mdSTYLE_SPEC.md link.

Why this instead of listStyle

P3 was planned as list chrome (listStyle) plus an example page. I did the example page and deferred the chrome API, for two reasons:

  1. Most chrome cannot be honored natively. Pull to refresh is a system control on both platforms (UIRefreshControl, SwipeRefreshLayout); the section index rail is three independent constant sets; the reorder count badge is drawn on Canvas inside Android's dispatchDraw. A unified API over that would declare knobs that silently do nothing on some platforms — the opposite of what the spec is for.
  2. The native row style from feat(native-list): apply the row style on iOS and Android #110 is not device-verified yet. Stacking more unverified native changes on top makes any regression harder to localize.

So P3 delivers the thing that actually unblocks verification.

The page is a regression check, not a gallery

Every template renders twice — plain, then styled — behind a toggle. With the toggle off, the page must match the build from before the row style existed. Unstyled rows must not move by a pixel; that is the single most important thing to confirm on device.

The styled rows deliberately target what the field-to-view mapping is most likely to get wrong:

Row What it proves
metricCard style.value must hit the large number and style.title the small label, even though they share views with identity's title and subtitle
message style.body and style.time reach the subtitle and status views
identity A named token ($bodyMd), a raw override, badge, value, plus horizontalPadding and lineGap
rail, action Slots that sit outside the main text column
explicit height Text grown with $headingMd and an explicit height, because heights are not derived from the style (§6.1)

Verification

  • The page typechecks cleanly against the worktree package source. The example app resolves @onekeyfe/react-native-native-list through a workspace symlink whose types point at an unbuilt lib/, so every NativeList page in the example already fails with TS2307 — pre-existing, 12 files. I verified this page with a throwaway tsconfig mapping the import to src/index.ts; 0 errors, and the temp file is not committed.
  • eslint on the new page and route.tsx — clean.
  • The example app's own tsc --noEmit has 72 pre-existing errors on main-equivalent code and is not a usable gate.

What to check on device

  1. Open Native List Row Style, toggle the style off, and compare against a build without this stack — every row should be identical.
  2. Toggle on: confirm the metricCard large number grows and turns green while its small label shrinks — if those two swap, the mapping is wrong.
  3. Confirm no row clips its text, and that scrolling fast does not leak a font size into a neighbouring row (the recycling reset from feat(native-list): apply the row style on iOS and Android #110).

🤖 Generated with Claude Code

The row style now exists on all three platforms but only the Web half has
automated coverage, so the native halves need something to check against. This
page is that artifact.

Every template is rendered twice - plain, then styled - behind a toggle. With
the toggle off the whole page must match the build from before the row style
existed, which is the regression check that matters most: unstyled rows must not
move by a pixel.

The rows deliberately cover what the field-to-view mapping is most likely to get
wrong. metricCard styles `value` and `title` separately, and the two must land on
the large number and the small label respectively even though they share views
with identity's title and subtitle. message styles `body` and `time`, which are
carried by the subtitle and status views. One identity row grows its text and
gives an explicit height, because heights are not derived from the style.

Also link STYLE_SPEC.md from DESIGN.md, so the architecture document points at
the style vocabulary.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* every row is untouched, so the whole page should be pixel-identical to the
* build before the row style existed - that is the regression check.
*/
function buildRows(styled: boolean): RowModel[] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: [The regression page does not cover every styled row template]

When this page is used as the documented cross-platform regression check, buildRows only creates styled counterparts for identity, metricCard, message, rail, and action. The NativeList model also exposes style surfaces for activity, dataRow, market, mediaTile, sectionHeader, system, and walletGroup, so regressions in those binders are never rendered or exercised by the toggle.

Please add representative plain/styled pairs for the missing templates (including a styled section header) and have the toggle remove each counterpart’s style object, so the page actually covers the promised all-template comparison.

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