JengaPullToRefresh

fun JengaPullToRefresh(isRefreshing: Boolean, onRefresh: () -> Unit, modifier: Modifier = Modifier, content: @Composable BoxScope.() -> Unit)(source)

Wraps scrollable content with pull-to-refresh. Drag down past the top to trigger onRefresh; show the spinner by setting isRefreshing true while the refresh runs, then false when it completes.

The content must be vertically scrollable (a LazyColumn, or a Column with verticalScroll) for the gesture to be reachable.

JengaPullToRefresh(
isRefreshing = state.isRefreshing,
onRefresh = { onEvent(Refresh) },
content = {
LazyColumn(
modifier = Modifier.fillMaxSize(),
content = { /* items */},
)
},
)

Parameters

isRefreshing

whether a refresh is currently in progress (drives the spinner).

onRefresh

called when the user pulls to refresh.

modifier

the Modifier for the container.

content

the scrollable content, laid out in a BoxScope.

Samples

JengaPullToRefresh(
    isRefreshing = false,
    onRefresh = { },
    content = {
        JengaText(
            text = "Pull down to refresh",
        )
    },
)