Skip to content

Commit de861e0

Browse files
committed
fix(Item): a list row's touch press release runs on the compositor
The release animated a registered custom property feeding a gradient, which runs on the main thread: while script ran, a released row stayed fully pressed, then snapped to rest, and every frame of the fade repainted the row. The press now paints on a ::before layer whose opacity is the strength; the release is an opacity keyframe animation on the same clock and curve (from the UIKit constants table), which keeps fading on the compositor and does no Layout or Paint. Item and TreeList rows compose it.
1 parent 1d95804 commit de861e0

11 files changed

Lines changed: 994 additions & 8 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[fix] A list row's touch press release keeps fading while the page runs script. `ListItem`, `Item` and `TreeList` rows used to stay fully pressed after the finger lifted until the main thread was free, and every frame of the fade repainted the row; the release now runs on the compositor, with the same color, clock and curve as before. On an interactive row the press paints on the row's `::before`, so a row's own `::before` set through `xstyle` or `className` replaces the press paint.
6+
7+
@vjeux

‎packages/core/src/Item/Item.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
/**
66
* @file Item.tsx
7-
* @input Uses React, ReactNode, StyleXStyles, theme tokens, useClickableContainer
7+
* @input Uses React, ReactNode, StyleXStyles, theme tokens, useClickableContainer,
8+
* the shared press overlays and the compositor press layer
89
* @output Exports Item component, ItemProps type; publishes the shared inline inset
910
* @position Core layout primitive; consumed by index.ts, tested by Item.test.tsx
1011
*
@@ -53,6 +54,7 @@ import {useDevWarning} from '../hooks/useDevWarning';
5354
import {themeProps} from '../utils/themeProps';
5455
import {focusOutlineProps} from '../utils/focusOutline.stylex';
5556
import {interactionOverlayStyles} from '../utils/interactionOverlay.stylex';
57+
import {pressLayerStyles} from '../utils/pressLayer.stylex';
5658
import {usePressFeedback} from '../hooks/usePressFeedback';
5759
import type {ItemSwipeBridge} from './ItemSwipeLayer';
5860

@@ -884,6 +886,10 @@ export function Item({
884886
align === 'first-line' && styles.alignFirstLine,
885887
isInteractive && styles.interactive,
886888
isInteractive && interactionOverlayStyles.backgroundColor,
889+
// The touch press on a compositor layer (after the overlay, whose
890+
// own touch paint it turns off): the release keeps fading while
891+
// script runs.
892+
isInteractive && pressLayerStyles.cell,
887893
isLinkRoot && styles.linkRoot,
888894
isHighlighted && styles.highlighted,
889895
isSelected && styles.selected,

0 commit comments

Comments
 (0)