diff --git a/Android/doric/src/main/java/pub/doric/pullable/RefreshableNode.java b/Android/doric/src/main/java/pub/doric/pullable/RefreshableNode.java index 329f8207..3e87de2a 100644 --- a/Android/doric/src/main/java/pub/doric/pullable/RefreshableNode.java +++ b/Android/doric/src/main/java/pub/doric/pullable/RefreshableNode.java @@ -1,7 +1,5 @@ package pub.doric.pullable; -import android.view.animation.Animation; - import com.github.pengfeizhou.jscore.JSObject; import com.github.pengfeizhou.jscore.JSValue; import com.github.pengfeizhou.jscore.JavaValue; @@ -45,6 +43,14 @@ public class RefreshableNode extends SuperNode implements Pull mContentViewId = prop.asString().value(); } else if ("header".equals(name)) { mHeaderViewId = prop.asString().value(); + } else if ("onRefresh".equals(name)) { + final String funcId = prop.asString().value(); + mView.setOnRefreshListener(new DoricSwipeLayout.OnRefreshListener() { + @Override + public void onRefresh() { + callJSResponse(funcId); + } + }); } else { super.blend(view, name, prop); } diff --git a/demo/src/RefreshableDemo.ts b/demo/src/RefreshableDemo.ts index 280ed5ef..743da1e6 100644 --- a/demo/src/RefreshableDemo.ts +++ b/demo/src/RefreshableDemo.ts @@ -7,6 +7,12 @@ class RefreshableDemo extends Panel { let refreshImage: Image let refreshView = refreshable({ layoutConfig: layoutConfig().atmost(), + onRefresh: () => { + log('onRefresh') + setTimeout(() => { + refreshView.setRefreshing(context, false) + }, 5000) + }, header: pullable(context, stack([ image({