Lynx

Attributes

enable-refresh

Android
iOS
Harmony
// @defaultValue: true
'enable-refresh'?: boolean;

Determines if dragging down or calling autoStartRefresh can trigger the startrefresh event.

Events

Frontend can bind corresponding event callbacks to listen for runtime behaviors of the element, as shown below.

bindheaderoffset

Android
iOS
Harmony
bindheaderoffset = (e: RefreshHeaderOffsetEvent) => {};
FieldTypeOptionalDefaultPlatformsSinceDescription
isDraggingbooleanNo
Android
iOS
Harmony
Indicates if <refresh-header> is being dragged
offsetPercentnumberNo
Android
iOS
Harmony
The ratio of the pull-down movement distance to its own height

Triggered during movement when <refresh-header> is exposed.

bindrefreshstatechange

Android
iOS
Harmony
bindrefreshstatechange = (e: RefreshStateChangeEvent) => {};
FieldTypeOptionalDefaultPlatformsSinceDescription
stateRefreshStateNo
Android
iOS
Harmony
Indicates if <refresh-header> is being dragged

Triggered when <refresh-header> state changes.

bindstartrefresh

Android
iOS
Harmony
bindstartrefresh = (e: RefreshStartRefreshEvent) => {};
FieldTypeOptionalDefaultPlatformsSinceDescription
isManualbooleanNo
Android
iOS
Harmony
Indicates whether the startrefresh event is triggered by manual drag

Triggered when enable-refresh is true, and dragging down or calling autoStartRefresh (enters refresh state).

Methods

Frontend can invoke component methods via the SelectorQuery API.

autoStartRefresh

Android
iOS
Harmony

lynx.createSelectorQuery()
     .select('#id')
     .invoke({
      method: 'autoStartRefresh',
      success: function (res) {},
      fail: function (res) {},
    })
    .exec();

When enable-refresh is true, call this method to expose the entire <refresh-header> , triggering the startrefresh event, after which <refresh-header> will attach to the top edge of the refresh's viewport.

finishRefresh

Android
iOS
Harmony

lynx.createSelectorQuery()
     .select('#id')
     .invoke({
      method: 'finishRefresh',
      success: function (res) {},
      fail: function (res) {},
    })
    .exec();

Called after the startrefresh event to end the refresh state, making <refresh-header> rebound.

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.