Skip to main content

Module pullrefresh

Module pullrefresh 

Source
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 (UIRefreshControl attached to the descendant UIScrollView), Android (the Android toolkit’s DayPullRefresh extends SwipeRefreshLayout), HarmonyOS (ARKUI_NODE_REFRESH). The piece is a container: its realized native view hosts the scrollable as a Day child, using the cx.native + fill-layout + cx.under recipe.
  • 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§

PullRefresh
A scrollable wrapped with pull-to-refresh. Build with pull_to_refresh.
RefreshProps
Full props (realize) for the native-tier container.

Enums§

RefreshPatch
Sparse command sent to the native wrapper after creation.

Constants§

KIND

Traits§

PullRefreshBuilder
Builder methods of PullRefresh, reachable through a Decorated (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 (a scroll(...) or list(...)) with pull-to-refresh bound to refreshing.
support
How pull-to-refresh is realized on the compiled backend: Native (a real platform refresh control drives the gesture and indicator) or Emulated (composition overlay; gesture where the toolkit exposes overscroll). Never Unsupported: the emulated tier always works.