Skip to content

Commit 9e6ee49

Browse files
committed
修复重复添加onRefresh事件的bug
Signed-off-by: 2534290808 <2534290808@qq.com>
1 parent ee5962f commit 9e6ee49

File tree

3 files changed

+113
-43
lines changed

3 files changed

+113
-43
lines changed

.idea/workspace.xml

Lines changed: 104 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SmartRefreshControl.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,22 @@ class SmartRefreshControl extends Component {
3939
}
4040
return <ClassicsHeader/>
4141
}
42+
_onSmartRefresh=()=>{
43+
this.props.onRefresh && this.props.onRefresh();
44+
}
4245
//TODO://还未实现
4346
renderFooter=()=>{
4447
return null;
4548
}
4649
render() {
50+
const nativeProps = Object.assign({},...this.props);
51+
Object.assign(nativeProps, {
52+
onSmartRefresh:this._onSmartRefresh,
53+
});
4754
return (
4855
<SmartRefreshLayout
4956
ref="refreshLayout"
50-
{...this.props}
57+
{...nativeProps}
5158
>
5259
{this.renderHeader()}
5360
{this.props.children}

android/src/main/java/com/lmy/smartrefreshlayout/Events.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
public enum Events {
8-
REFRESH("onRefresh"),
8+
REFRESH("onSmartRefresh"),
99
LOADMORE("onLoadMore");
1010

1111
private final String mName;

0 commit comments

Comments
 (0)