Marks a scrollable view as refreshable, enabling the user to pull down to trigger an asynchronous data reload.
Use the refreshable
modifier on scrollable views—such as <List>
—to implement pull-to-refresh functionality. When the user pulls down past the top of the view, the framework executes the asynchronous handler defined by refreshable
.
Inside the handler, you can perform any asynchronous operations (e.g., fetching network data or updating local state), and once the operation completes, the refresh control will automatically dismiss.
This behavior closely mirrors SwiftUI’s refreshable
modifier.
The refreshable
function must return a Promise<void>
. The refresh control remains visible until the promise resolves.
Use await
inside the refresh function to perform async tasks:
This modifier is only effective on scrollable containers, such as <List>
.
You should update the relevant state inside the handler to reflect new data.
Avoid long-running or blocking tasks without feedback; always resolve the promise in a timely manner to dismiss the refresh spinner.
Keep refresh logic short and efficient.
Always resolve the promise to ensure the UI doesn’t hang.
If needed, use a short delay to simulate refresh animations during development: