Expand description
day_pieces::pullrefresh: pull-to-refresh for any Day scrollable, modeled on SwiftUI’s
refreshable(action:) (DESIGN.md §15; docs/extending.md).
ⓘ
let refreshing = Signal::new(false);
pull_to_refresh(refreshing, scroll(rows)) // or list(items, …)
.on_refresh(move || {
let done = refreshing.setter();
std::thread::spawn(move || { reload(); done.set(false); });
})Semantics (the same contract as UIRefreshControl / SwipeRefreshLayout.setRefreshing /
ArkUI Refresh.refreshing): the bound refreshing: Signal<bool> is TWO-WAY. A user pull sets
it true and runs on_refresh; the app sets it false when its reload completes (from a
thread via day_reactive::Signal::setter, or inside day::task); the app may also set it
true to begin a refresh programmatically. The piece’s node additionally accepts
Event::ToggleChanged as a synthetic begin/end, so dayscript’s existing toggle: step drives
it on every backend.
Tiers (support):
- Native: iOS (
UIRefreshControlattached to the descendantUIScrollView), Android (the Android toolkit’sDayPullRefresh extends SwipeRefreshLayout), HarmonyOS (ARKUI_NODE_REFRESH). The piece is a container: its realized native view hosts the scrollable as a Day child, using thecx.native+ fill-layout +cx.underrecipe. - Emulated, everywhere else: a pure-composition spinner overlay (
when(refreshing, …)), with the pull gesture detected on AppKit (elastic-scroll overscroll) and GTK (edge-overshot); Qt and XAML are spinner + programmatic in v1.
Structs§
- Pull
Refresh - A scrollable wrapped with pull-to-refresh. Build with
pull_to_refresh. - Refresh
Props - Full props (realize) for the native-tier container.
Enums§
- Refresh
Patch - Sparse command sent to the native wrapper after creation.
Constants§
Traits§
- Pull
Refresh Builder - Builder methods of
PullRefresh, reachable through aDecorated(docs/api-style.md “Typed builders and erasure”): generic modifiers and typed ones chain in any order.
Functions§
- gesture_
support - Whether a user pull gesture can begin a refresh on this toolkit.
- pull_
to_ refresh - Wrap
child(ascroll(...)orlist(...)) with pull-to-refresh bound torefreshing. - support
- How pull-to-refresh is realized on the compiled backend:
Native(a real platform refresh control drives the gesture and indicator) orEmulated(composition overlay; gesture where the toolkit exposes overscroll). NeverUnsupported: the emulated tier always works.