Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh animation won't disappear #15

Open
dannydenovi opened this issue Nov 21, 2020 · 12 comments
Open

Refresh animation won't disappear #15

dannydenovi opened this issue Nov 21, 2020 · 12 comments

Comments

@dannydenovi
Copy link

The animation continues even if the list is empty, even by creating a new app and pasting the example code provided on the main page.

iOS 14.2, Xcode 12.2 (12B45b)

@cgray9
Copy link

cgray9 commented Nov 23, 2020

I have run into the same issue with iOS 14.2, Xcode 12.2. It works as expected with previous versions.

@iDrewn
Copy link

iDrewn commented Nov 24, 2020

Same here!

@neptunezxn
Copy link

Same here...

@Cofyka
Copy link

Cofyka commented Dec 5, 2020

I found a temporary solution which works for me. The main problem is that updateUIView() in PullToRefresh.swift isn't invoked by variable change anymore. I didn't go deeply into the problem, but that's what I discovered. I made this change to the code. I hope the author sees this and that it will help him.

Use it like this:
.pullToRefresh() { endRefreshing in DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { endRefreshing() } }

Cofyka added a commit to Cofyka/SwiftUIRefresh that referenced this issue Dec 5, 2020
I managed to fix this issue siteline#15
@txdrx
Copy link

txdrx commented Jan 10, 2021

Don't know why, but got it to work like this:

.pullToRefresh(isShowing: $isShowing) {
     DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
          self.isShowing= false
     }
}
// added these two lines:
.onChange(of: self.isShowing) { value in
}

edit:
if you call a func before setting "isShowing" back to false, it's also working

@sethduncan
Copy link

Don't know why, but got it to work like this:

.pullToRefresh(isShowing: $isShowing) {
     DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
          self.isShowing= false
     }
}
// added these two lines:
.onChange(of: self.isShowing) { value in
}

edit:
if you call a func before setting "isShowing" back to false, it's also working

This worked for me, but I did have to put an 'if available" statement in for iOS 14. Following this topic for an update from the author.

@JimmyJammed
Copy link

Bump. Is there a pending fix for this?

@rsergiu2003
Copy link

rsergiu2003 commented May 24, 2021

try an actual action, it's because of asyncAfter, it's not triggering a redraw, the idea is that it works fine on real scenarios

@viewDidAppear
Copy link

Facing the same issue even when using a real function. This is still a problem.

@stshelton
Copy link

stshelton commented Jul 28, 2021

I was facing the same issue. I found a workaround by using an observable object with a published boolean. I passed that published boolean from the observable object into pullToRefresh instead of passing a state variable and it worked as intended.

@ptrkstr
Copy link

ptrkstr commented Sep 5, 2021

@txdrx's solution worked best for me. Still waiting on official fix from library owner.

@Iccr
Copy link

Iccr commented Sep 10, 2021

I was facing the same issue. I found a workaround by using an observable object with a published boolean. I passed that published boolean from the observable object into pullToRefresh instead of passing a state variable and it worked as intended.

this worked for me. thanks man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests