PullToRefresh

Description of the component PullToRefresh and its attributes

What is it?

The PullToRefresh component configures a native “pull to refresh” behavior for the child component.

The structure is represented by the attributes below:

AttributeTypeRequiredDefinition
contextContextDataDefines a context for the component.
onPullList<Action>List of actions that are performed when the child component is pulled.
isRefreshingBoolean or BindingExpression that controls when the loading indicator is shown.
colorString or BindingDefines the color of the loading indicator.
childServerDrivenComponentDefines the component that will be configured with the PullToRefresh.

How to use it?

Container(
    children = listOf(
        PullToRefresh(
            context = ContextData("isRefreshing", false),
            onPull = listOf(
                SetContext(
                    contextId = "isRefreshing",
                    value = true
                ),
                Alert(
                    title = "Alert title",
                    message = "Alert message",
                    onPressOk =
                        SetContext(
                            contextId = "isRefreshing",
                            value = false
                        ),
                    labelOk = "Alert OK button"
                )
            ),
            isRefreshing = expressionOf("@{isRefreshing}"),
            color = "#0000FF",
            child = Text("PullToRefresh")
        )
    )
).setFlex {
    grow = 1.0
}