Skip to content

Commit 29bea1f

Browse files
committed
chore(core): UIRefreshControl's values in the UIKit table
refreshControl joins the UIKit constants table: the refreshing inset and the one-to-one stretch of a pull, the trigger distance against the scroll view's height (0.198 x the height, never below 73 pt), the pull after the trigger, the indicator's reveal curve, spokes, spin, trigger spring and exit, and the end-of-refresh clock, each measured on the iOS 26.2 simulator or labelled a guess with its measurement task. It reads as uikit.refreshControl through the experimental motion subpath.
1 parent b496085 commit 29bea1f

9 files changed

Lines changed: 301 additions & 3 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+
[experimental] The UIKit constants table read through `@astryxdesign/core/motion/experimental` gains UIRefreshControl's values as `uikit.refreshControl`: the refreshing inset, the trigger distance against the scroll view's height, the pull after the trigger, the indicator's reveal, spin and exit, and the end-of-refresh clock, each measured on the iOS 26.2 simulator or labelled a guess with its measurement task. Four of them are motion roles a theme may retune (`refreshControl.endMs`, `refreshControl.exitMs`, `refreshControl.spinMs`, `refreshControl.triggerTurnSpring`).
6+
7+
@vjeux

‎packages/cli/assets/docs/motion.doc.mjs‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,30 @@ const calmTheme = defineTheme({
190190
'duration',
191191
'350ms',
192192
],
193+
[
194+
'refreshControl.endMs',
195+
'--motion-refresh-control-end-ms',
196+
'duration',
197+
'300ms',
198+
],
199+
[
200+
'refreshControl.exitMs',
201+
'--motion-refresh-control-exit-ms',
202+
'duration',
203+
'300ms',
204+
],
205+
[
206+
'refreshControl.spinMs',
207+
'--motion-refresh-control-spin-ms',
208+
'duration',
209+
'1000ms',
210+
],
211+
[
212+
'refreshControl.triggerTurnSpring',
213+
'--motion-refresh-control-trigger-turn-spring',
214+
'spring',
215+
'2.3416s 0',
216+
],
193217
['scroll.bounce', '--motion-scroll-bounce', 'spring', '0.5s 0'],
194218
[
195219
'scroll.paging.snap',

‎packages/cli/test/__golden__/no-icon-set/docs-topics.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
"touch-motion",
202202
"best-practices"
203203
],
204-
"skeleton": "d2f0fea1e87d53e70f4e7f542844d17c6fecf13c25300df0ed1d0cac71aa4023",
204+
"skeleton": "d5314896677a615d939c780dbed90105c655fa6d36395864f6d8fc7a60066785",
205205
"mentions": []
206206
},
207207
"principles": {

‎packages/core/src/motion/MEASUREMENTS.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,30 @@ fades in, with Prefer Cross-Fade Transitions on or off.
269269
| M-CM4 | Reduce Motion press feedback | Probe app with Reduce Motion on: long press, then dismiss | press feedback, lift and dismiss animations under Reduce Motion | A, B |
270270
| M-CM5 | Commit haptic stand-in | An Android device: `navigator.vibrate` patterns against the platform's HapticFeedbackConstants for the context-click moment | the pattern that matches; not a UIKit parity value (as M-G18) | H |
271271
| M-CM6 | Press thresholds | Probe app: repeated long presses at random vsync phases | from touch receipt and from the HID timestamp, the tick before and the tick at the press observer's began and at the click commit; the intersection pins the 150 ms and 400 ms thresholds | C |
272+
273+
## Refresh control (UIRefreshControl)
274+
275+
Values the refresh control reads from its own table (`uikit/refresh.ts`); its
276+
release onto the inset is `scroll.bounce` (M-S3) and its pull past the
277+
control's height is `scroll.rubberBand`. Subject: RefreshLab, a UIKit host app
278+
with a `UIRefreshControl` on a table view (334, 400, 874 and 1366 pt tall on
279+
the iPhone 17 Pro simulator) and buttons for `beginRefreshing` and
280+
`endRefreshing`.
281+
282+
Done (iOS 26.2 simulator, Oct 23 2026; in the refresh control's table): the
283+
height and refreshing inset, the one-to-one pull up to the height, the trigger
284+
distance against the view's height (and its floor), the trigger moment (finger
285+
down), the step after it, the release onto the inset, the reveal (a paused
286+
replicator scrubbed by overscroll ÷ trigger distance; 8 spokes), the spin and
287+
trigger springs, the end clock (three runs at rest, identical), that a
288+
momentum overshoot never triggers, that a pull while refreshing fires
289+
`valueChanged` again, and that the trigger makes no feedback-generator call
290+
(at 50, 150 and 400 pt/s).
291+
292+
| ID | What | App and gesture | Extract | Method |
293+
| ----- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------ |
294+
| M-RC2 | Indicator placement | RefreshLab: slow pulls to 2 × the trigger distance on the 400 and 874 pt views, a screen recording beside the layer log | the control's frame and the spinner's position against the overscroll (moves with the content, pinned, or centred in the gap) | B, C |
295+
| M-RC3 | Pull after the trigger | RefreshLab: pulls to 300 pt at 150 and 50 pt/s on the 334 and 874 pt views; a second pull while refreshing | the offset against the finger past 2 × `height` (is the step back systematic?), and the distance at which a pull while refreshing fires | C |
296+
| M-RC4 | Trigger springs | RefreshLab: pulls through the trigger at 50, 150 and 400 pt/s | the trigger springs' `allowsOverdamping`, target values (`instanceAlphaOffset`, `instanceColor`), stiffness against the release speed | A |
297+
| M-RC5 | End of a refresh | RefreshLab: `endRefreshing` while scrolled 300 pt away, while dragging, with a touch 100 ms into it, and 50 ms after a begin | what moves when scrolled away, the end under a finger, what a touch during the end does, any minimum visible time; a screen recording | A, B |
298+
| M-RC7 | Programmatic begin | RefreshLab: `beginRefreshing` at the top and when scrolled 300 pt | whether the content moves to reveal the control, and its curve | A, C |

‎packages/core/src/motion/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ from the package entry point; components import it by path.
1616
| `uikit/scroll.ts` | UIScrollView: deceleration rates, rubber band, bounce-back spring, paging, `delaysContentTouches`, scroll to top. |
1717
| `uikit/timing.ts` | Non-spring clocks and curves: press highlight, Core Animation's named curves, keyboard, Reduced Motion cross-fade. |
1818
| `uikit/navigation.ts` | UINavigationController: push velocity, parallax, dimming, transition clock, interactive pop finish rule. |
19+
| `uikit/refresh.ts` | UIRefreshControl: height (refreshing inset), trigger, pull after the trigger, indicator reveal, spin, exit, end clock. |
1920
| `uikit/gestures.ts` | Gesture recognizer thresholds, the velocity filter and the haptic stand-ins, as typed entries the gesture system reads. |
2021
| `roles.ts` | Motion roles: each spring, duration and curve of a registered table, named by its path, and its CSS variable. |
2122
| `resolveMotion.ts` | A role's value under an element's theme, read once when a motion starts. |

‎packages/core/src/motion/roleKinds.generated.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import type {MotionRoleKind} from './roles';
1313

1414
export const MOTION_ROLE_KINDS: Readonly<Record<string, MotionRoleKind>> = {
1515
'navigation.transitionMs': 'duration',
16+
'refreshControl.endMs': 'duration',
17+
'refreshControl.exitMs': 'duration',
18+
'refreshControl.spinMs': 'duration',
19+
'refreshControl.triggerTurnSpring': 'spring',
1620
'scroll.bounce': 'spring',
1721
'scroll.paging.snap': 'spring',
1822
'springs.actionSheetDismiss': 'spring',

‎packages/core/src/motion/uikit/index.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
/**
44
* @file index.ts
55
* @input The domain files of the UIKit constants table
6-
* @output Re-exports `springs`, `scroll`, `timing`, `navigation` and the
7-
* gesture thresholds (`UIKIT_GESTURES` and the haptic tables)
6+
* @output Re-exports `springs`, `scroll`, `timing`, `navigation`, the
7+
* gesture thresholds (`UIKIT_GESTURES` and the haptic tables) and the
8+
* component domains (`refreshControl`)
89
* @position Entry of the UIKit constants table (motion/uikit). Internal to
910
* core: not exported from the package entry point
1011
*
@@ -29,6 +30,7 @@ export {
2930
type SourcedGestureConstant,
3031
} from './gestures';
3132
export {navigation, registerNavigationTable} from './navigation';
33+
export {refreshControl, registerRefreshControlTable} from './refresh';
3234
export {registerScrollTable, scroll} from './scroll';
3335
export {registerSpringsTable, springs} from './springs';
3436
export {registerTimingTable, timing} from './timing';
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright (c) Meta Platforms, Inc. and affiliates.
2+
3+
/**
4+
* @file refresh.test.ts
5+
* @input vitest, the refresh-control table and the motion role registry
6+
* @output Covers registerRefreshControlTable: reading the table registers
7+
* nothing; the call registers the table's motion roles, once
8+
* @position Testing; colocated with refresh.ts
9+
*/
10+
11+
import {describe, expect, it} from 'vitest';
12+
import {listMotionRoles} from '../roles';
13+
import {refreshControl, registerRefreshControlTable} from './refresh';
14+
15+
const refreshRoles = () =>
16+
listMotionRoles()
17+
.map(role => role.id)
18+
.filter(id => id.startsWith('refreshControl.'))
19+
.sort();
20+
21+
describe('registerRefreshControlTable', () => {
22+
it('registers the table’s motion roles only when called, once', () => {
23+
// Reading a value registers nothing.
24+
expect(refreshControl.endMs).toBe(300);
25+
expect(refreshRoles()).toEqual([]);
26+
registerRefreshControlTable();
27+
registerRefreshControlTable();
28+
expect(refreshRoles()).toEqual([
29+
'refreshControl.endMs',
30+
'refreshControl.exitMs',
31+
'refreshControl.spinMs',
32+
'refreshControl.triggerTurnSpring',
33+
]);
34+
});
35+
});

0 commit comments

Comments
 (0)