Skip to content

Commit d655e05

Browse files
committed
bug fixes
1 parent c82c729 commit d655e05

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# react-swipe-down-refresh
22

3+
[![npm version](https://badge.fury.io/js/react-swipe-down-refresh.svg)](https://badge.fury.io/js/react-swipe-down-refresh)
4+
[![license](https://img.shields.io/github/license/shettypuneeth/react-swipe-down-refresh.svg)](https://github.com/shettypuneeth/react-swipe-down-refresh/blob/main/LICENSE)
5+
36
Swipe down to refresh or pull-to-refresh control for mobile web applications.
47

58
The component is built using composable utilities to give fine grain control over the swipe-refresh behavior. These building blocks could be used independently to build your own swipe-refresh control.
@@ -27,6 +30,14 @@ yarn add react-swipe-down-refresh
2730

2831
---
2932

33+
## Try it online
34+
35+
---
36+
37+
> Open in a mobile web-browser or toggle the device mode on a web-browser
38+
39+
Try the app [online here](https://g4xc0y.csb.app/).
40+
3041
## Usage
3142

3243
---

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"pull refresh",
1010
"pull-to-refresh"
1111
],
12-
"version": "0.1.0",
12+
"version": "0.1.1",
1313
"description": "React swipe down to refresh component",
1414
"repository": {
1515
"url": "https://github.com/shettypuneeth/react-swipe-down-refresh",

src/SwipeRefreshCoordinator.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,13 @@ export class SwipeRefreshCoordinator {
141141
rotation: 0,
142142
nextFrame: false,
143143
});
144-
145-
this.onEndRefresh?.();
146144
}
147145

148146
private onRefreshComplete() {
149-
this.hideSpinner(() => this.reset());
147+
this.hideSpinner(() => {
148+
this.reset();
149+
this.onEndRefresh?.();
150+
});
150151
}
151152

152153
private triggerRefresh() {

src/useSwipeRefresh.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ export const useSwipeRefresh = (
6161
return () => {};
6262
}
6363

64-
if (!swipeRefreshCoordinator.current) {
65-
initialize(node);
66-
}
64+
initialize(node);
6765

6866
return () => {
6967
swipeRefreshCoordinator.current?.unregisterSwipeListeners();

0 commit comments

Comments
 (0)