Skip to content

Commit

Permalink
Fix odd animation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gh123man committed Jun 1, 2022
1 parent 88788bb commit a8fd793
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Sources/Refresher/Refresher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,10 @@ public struct RefreshableScrollView<Content: View, RefreshView: View>: View {
set(mode: .refreshing)
canRefresh = false


DispatchQueue.main.asyncAfter(deadline: .now() + config.holdTime) {
refreshAction {
refreshAction {
// The ordering here is important - calling `set` on the main queue after `refreshAction` prevents
// strange animaton behaviors on some complex views
DispatchQueue.main.asyncAfter(deadline: .now() + config.holdTime) {
set(mode: .notRefreshing)
DispatchQueue.main.asyncAfter(deadline: .now() + config.cooldown) {
self.canRefresh = true
Expand Down

0 comments on commit a8fd793

Please sign in to comment.