Repository navigation
spec(Avatar): React Native platform record - #12828
imdreamrunner wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on this draft record, and six fixes are needed whatever that decision is.
An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. What needs settling: DEC-1's row default, which departs from the rule in spec:AST-082 FR3 that a core prop keeps its defaults on every platform; the React Native-only initials prop; DEC-2's fallback paint and the 1.6x text-size cap; FR6's link opener; FR8's rule that initials centre in an avatar's uncovered part; and PR1–PR2.
Required fixes:
- FR7's hold-to-show tooltip contradicts
spec:AST-082FR3 andcomponent:TooltipFR5, which open a touch tooltip on a completed tap undertouchTriggerand close it on a second tap or a tap outside, so follow that rule as the Swift record does and update AR4 to match. - FR1's numeric sizes fall outside the generated native Avatar contract that
spec:AST-093FR5 requires, which offers onlyxsmtoxl(asserted inpackages/native/src/contract/contracts.test.ts), so keep the named sizes and verify against that contract, or change the contract first. - FR8 states both stacking orders, "slides under the one before it" and "an avatar the next one covers", so state the web's order, where each avatar overlaps the one before it.
- The description says "Group adaptations are web's (FR8)", but FR8 also centres initials in an avatar's uncovered part, which the web does not do, so name it in the description as a React Native addition.
- FR5 composes the name only from an
AvatarStatusDot, dropping the passed element's stringlabelthatcomponent:AvatarFR5 reads and that the record's own FR5 gap line treats as a gap, so require it in FR5. - The
onPressandcolorgap lines cite FR2, which does not forbid them, and every gap line describes a package the record never names, so close the prop set in FR1, anchor those gaps there, and name the package.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: the change is one added record, stacked on #12592: verified (one file, 246 added lines).
- Claim: the core Avatar record holds FR1–FR9 and AR1–AR7: verified.
- Claim: the record's id and core component link: verified in its frontmatter.
- Claim: the avatar grows up to 1.6 times as the Swift record states: verified, though the Swift record is itself a draft.
- Claim: the status sits outside the clip at web's places: verified against the core placement clause.
- Claim: group adaptations are web's: false, FR8 adds the uncovered-part rule.
- Claim: six gap lines, and the listed requirement, ordering, performance and decision ids: verified.
- Claim: no React Native implementation exists in this repository: verified.
- Claim: no other record or open pull request owns Avatar on React Native: verified.
- Claim: the knowledge check and Prettier pass: verified at the head.
- File: docs/specs/components/Avatar/Avatar.react-native.spec.md: the findings above.
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on this draft record, and one fix is needed whatever that decision is. The six fixes from the last review are in: the tap tooltip, named sizes, status label, group order, the description's group claim, and the gap lines anchored to a closed prop set.
An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. What needs settling: DEC-1's empty default tooltip inside an Item or List row, which departs from the rule in spec:AST-082 FR3 that a core prop keeps its defaults on every platform (an explicit tooltip there also makes the avatar a tap target inside a pressable row, which component:Tooltip leaves open); the React Native-only initials prop; DEC-2's fallback paint and the 1.6x text-size cap; FR6's link opener; FR8's rule that initials centre in an avatar's visible part; and PR1–PR2.
Required fix:
- The Contract at a glance rows are out of date after this push: Compatibility/readiness says the gap lines sit under FR2, FR3, FR4 and FR5 while they now sit under FR1, FR3, FR4, FR5 and FR7, and Builder impact says web code ports unchanged unless it passes
as,targetorrel, although FR1 now refuses numeric sizes.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: the change is one added record stacked on its base pull request: verified (one file, 253 added lines).
- Claim: the record is the React Native platform record of the core Avatar and states only what React Native adds or does differently: id and core link verified; it also restates parts of the core record.
- Claim: the props are web's without
as,targetandrel, with the named sizes the generated native contract projects, plusinitials, and no others: verified against the generated contract and its test. - Claim: the fallback chain and initials rule are web's: verified.
- Claim: growth to 1.6 times the text size, as the Swift record states: verified, though the Swift record is a draft.
- Claim: the status sits at web's places and its label comes from a status dot, else the passed element's label: verified.
- Claim: links open through the app's link opener,
onClickmakes a button, and interactive avatars take a full touch target: verified. - Claim: an omitted tooltip shows the name except in an Item or List row, and a tap opens it on an avatar with no tap action: verified against the record and the core Tooltip touch rule.
- Claim: in a group the size, shape, ring and overlap are web's, and React Native adds the uncovered-part initials: verified.
- Claim: eight gap lines name where the package differs: verified.
- Claim: no React Native implementation exists in this repository, and no other record or open pull request owns Avatar on React Native: verified.
- Claim: the knowledge check, Prettier and the whitespace check pass: verified at this head.
- File: docs/specs/components/Avatar/Avatar.react-native.spec.md: the findings above.
| activation. | ||
| - **AR3 — The tooltip is a hint.** Tooltip words other than the name are read | ||
| as the hint after the name; the name is never read twice. | ||
| - **AR4 — Touch target.** A link or button avatar, and a static avatar with a |
There was a problem hiding this comment.
Non-blocking: AR4 now gives a static avatar with a tooltip the platform touch target and cites FR6, but FR6 states the target for link and button avatars only, and the FR6, AR2, AR4 verification row has no static-tooltip state. Name that avatar in FR6 and add the state.
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on this draft record; the at-a-glance rows from the last review now match the requirements, and no other fix is required.
An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. What needs settling: DEC-1's empty default tooltip inside an Item or List row, which departs from the rule in spec:AST-082 FR3 that a core prop keeps its defaults on every platform (an explicit tooltip there also makes the avatar a tap target inside a pressable row, which component:Tooltip leaves open); the React Native-only initials prop; DEC-2's fallback paint and the 1.6x text-size cap; FR6's link opener; ORD3's rule that a rejected href with onClick makes a button, where component:Avatar keeps href first; FR8's rule that initials centre in an avatar's visible part; and PR1–PR2.
The inline comments carry the non-blocking notes, among them the touch target FR6 leaves out for a static avatar with a tooltip and the same-layer limit FR8 drops from the core group rule.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: the change is one added record, stacked on the pull request that lets the knowledge check accept React Native records: verified (one file, 253 added lines, on that branch).
- Claim: the record is the React Native platform record of the core Avatar and states only what React Native adds or does differently: id and core link verified; it also restates parts of the core record.
- Claim: the existing authority listed was searched, and no other record or open pull request owns Avatar on React Native: verified; the Swift record it leans on is a draft.
- Claim: the props are web's without
as,targetandrel, with the named sizes the generated native contract projects, plusinitials, and no others: verified against the generated contract and its test;initialsis not in that contract. - Claim: the fallback chain and initials rule are web's: verified.
- Claim: growth to 1.6 times the text size as the Swift record states, and a gray fallback in a hairline ring: verified as the record's text; the Swift record is a draft.
- Claim: the status sits at web's places and its label comes from a status dot, else the passed element's label: verified.
- Claim: an accepted
hrefopens through the app's link opener,onClickmakes a button, and interactive avatars take a full touch target: verified; a rejectedhrefwithonClickalso becomes a button, unlike the core order. - Claim: an omitted tooltip shows the name except in an Item or List row, and a tap opens it on an avatar with no tap action: verified against the record and the core Tooltip touch rule.
- Claim: in a group the size, shape, ring and overlap are web's, and React Native adds the uncovered-part initials: verified, except that the same-layer limit is not restated.
- Claim: eight gap lines name where the package differs: verified, under FR1, FR3, FR4, FR5 and FR7.
- Claim: the claim scope and an empty open-questions list: verified.
- Claim: no React Native implementation exists in this repository, and the verification map names the evidence for each requirement: verified.
- Claim: the writing rubric finds no narration, research, status, pull request references or rejected alternatives in the record: verified.
- Claim: the record and the public text carry no internal context: verified.
- Claim: the knowledge check, Prettier and the whitespace check pass: verified at this head.
- File: docs/specs/components/Avatar/Avatar.react-native.spec.md: no required fix; the owner decision above and the inline non-blocking notes.
| - **ORD1 — Visual.** `src` → `fallbackSrc` → `initials` as given → initials of | ||
| `name` → silhouette. | ||
| - **ORD2 — Name.** `alt` → `name`, then joined with a reported status label. | ||
| - **ORD3 — Root.** An accepted `href` → `onClick` → static. |
There was a problem hiding this comment.
A rejected href changes the root order. component:Avatar ORD3 is href → onClick → static, and on the web a rejected destination still takes the link root: an anchor with no destination and no role, so onClick does not make it a button (useLinkComponent.ts, Avatar.tsx). Here a rejected href with onClick becomes a button. It needs the owner's decision with the record's other departures; if it should match the web, say that a rejected href leaves a root with no role that opens nothing.
| | FR5 | A `status` MUST draw in a slot outside the avatar's clip that takes no touches: on a circle centred on the circle's edge at the bottom trailing 45° point, on a rounded or square avatar at the bottom trailing corner, overhanging it by a quarter of its size; placement is logical, so it mirrors in right-to-left. The status label, the one an `AvatarStatusDot` in the slot reports at any wrapper depth, which wins, else a string `label` on the passed element, read on every render, joins the avatar's name as the catalog's "{name}, {status}", and a status label alone names the avatar. | `component:Avatar` FR4, FR5; `component:AvatarStatusDot` | verify | | ||
| | FR6 | An `href` that `family:navigation-destinations` accepts MUST make the avatar a link: a press runs `onClick` and then opens the destination through the app's link opener, the `LinkProvider` above it, else the system's URL opener. A rejected destination reaches no opener and leaves no link role. Otherwise `onClick` makes a button, and with neither the avatar is static. A link or button avatar draws the platform's press feedback in its shape, a ripple on Android, shows the theme's focus outline when it has focus, and reaches the platform's minimum touch target (44 pt on iOS, 48 dp on Android) through its hit area without changing its size. An interactive avatar with neither `name` nor `alt` warns once in development. | `component:Avatar` FR6, AR7; `family:navigation-destinations`; `spec:AST-082` FR11 | verify | | ||
| | FR7 | `tooltip` MUST resolve as web's does: omitted or `true` is the name, a string is those words, and `false` or blank words are none; an omitted `tooltip` inside an Item or List row is none (DEC-1). Words other than the name are the avatar's accessibility hint. Under a finger the tooltip follows `component:Tooltip` FR5 with `touchTrigger` `auto`: on an avatar with no tap action a completed tap opens it, and a second tap on the avatar or a tap outside closes it; on a link or button avatar a tap performs its action and opens nothing. | `component:Avatar` FR7; `component:Tooltip` FR5; `spec:AST-082` FR3; DEC-1 | verify | | ||
| | FR8 | Inside an AvatarGroup, the group's size and shape MUST win over the avatar's own. Each avatar overlaps the one before it by a quarter of its size, as on the web, and draws a 2 dp ring in `color.backgroundSurface` outside its box. The initials of an avatar the next one covers centre in its uncovered part, so every visible avatar's letters stay whole. | `component:Avatar` FR8 | verify | |
There was a problem hiding this comment.
Non-blocking: component:Avatar FR8 and ORD4 apply the group's size, shape, ring and overlap only to members in the same layer; an avatar in a popover or hover card opened from a group keeps its own. This FR and ORD5 drop that limit. Suggest: "Inside an AvatarGroup in the same layer, …", or cite core FR8 and keep only the uncovered-part rule.
| | Public contract | Web's `Avatar` props `src`, `fallbackSrc`, `name`, `alt`, `size` (the named sizes), `shape`, `status`, `tooltip`, `href` and `onClick`, without `as`, `target` and `rel`. React Native adds `initials`. | | ||
| | Behavior | The photo, then the fallback photo, then initials, then a drawn silhouette, in the theme's gray pairing inside a ring. The status sits outside the clip. A static avatar is a named image; `href` makes a link that opens through the app's link opener, and `onClick` a button. An omitted tooltip shows the name, except in an Item or List row; under a finger a tap opens it on an avatar with no tap action. | | ||
| | End-user impact | A person sees the same face, initials or silhouette as on the web, on any surface in light and dark; VoiceOver and TalkBack read who the avatar is and its status in one name; a small interactive avatar still takes a full-size touch. | | ||
| | Builder impact | Web code that renders an `Avatar` ports unchanged unless it passes `as`, `target`, `rel` or a numeric `size`. A data source that already has a person's initials passes them as `initials`. | |
There was a problem hiding this comment.
Non-blocking: DEC-1 adds a caller choice this row does not name: a row avatar that relied on the default name tooltip passes tooltip explicitly on React Native. Suggest adding: "Inside an Item or List row, pass tooltip to keep the name tooltip."
Stacked on #12592 (it lets
check:knowledgeacceptreact-nativeplatform records); the base is that branch. This PR's change is one file:docs/specs/components/Avatar/Avatar.react-native.spec.md.Exact decision needed
How React Native renders
Avatar: which web props it takes, what it adds, how its fallback paints, and how its link, button and tooltip behave under a finger. The record is the React Native platform record ofcomponent:Avatar(component:react-native/Avatar,platform_of: component:Avatar). It states only what React Native adds or does differently.Existing authority searched
component:Avatar(FR1–FR9, AR1–AR7) and its Swift record;component:AvatarStatusDot;component:AvatarGroup;component:Tooltip;family:navigation-destinations;architecture:knowledge-contracts(platform records beside the core record);spec:AST-082FR3, FR5, FR7, FR11 andspec:AST-093FR1–FR5; the other React Native platform records (spec(TabBar): React Native platform record #12686, spec(Button): React Native platform record #12817).packages/core/src/Avatar/(props, the fallback chain, the initials rule, status placement).Decision
src,fallbackSrc,name,alt,size(the named sizes the generated native contract projects),shape,status,tooltip,hrefandonClick, plusinitials, and no other props; it does not offeras,targetandrel(FR1).initialstakes letters a data source already has (FR2).AvatarStatusDot's reported label, else a stringlabelon the passed element (FR5).hrefmakes a link that opens through the app's link opener;onClickmakes a button; interactive avatars take a full platform touch target through their hit area (FR6).component:TooltipFR5 withtouchTriggerauto: a tap opens it on an avatar with no tap action (FR7). In a group, the size, shape, ring and overlap are web's; React Native adds that the initials of a covered avatar centre in its uncovered part (FR8).@astryxdesign/react-nativediffers: numeric sizes,onPressand a per-call-sitecolor(FR1), emoji initials on an engine without grapheme segmentation (FR3), size at large text (FR4), the dot's angle and a passed element'slabel(FR5), and a hold-to-show tooltip (FR7).Rejected alternatives
None recorded.
Claim scope and non-goals
The claims are FR1–FR8, AR1–AR4, ORD1–ORD5, PR1–PR2 and DEC-1–DEC-2. The record's "Does not own" list names the owner of each adjacent responsibility.
Open questions: none.
Evidence and implementation relationship
No React Native implementation exists in this repository. The record states the target behavior, and its verification map names the evidence for each requirement: unit tests of the package, Simulator and emulator captures, touch checks, and VoiceOver and TalkBack checks. Where the behavior does not meet the target, the record lists a requirement gap line (FR1, FR3–FR5, FR7).
Writing rubric results
Released default preserved.Scope
Components: Avatar
Validation
node scripts/check-knowledge.mjs: passes ("Knowledge templates and records are aligned.")git diff --check: clean