Skip to content

Commit

Permalink
Prevent animation glitch when dismissing during sheet presentation (s…
Browse files Browse the repository at this point in the history
…tripe#3555)

## Summary
We'll just prevent the user from tapping out of the sheet if we're
currently animating.

## Motivation
RUN_MOBILESDK-3118

## Testing
In PS Example

## Changelog
None
  • Loading branch information
davidme-stripe authored May 2, 2024
1 parent d44b557 commit 510781d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ class BottomSheetPresentationController: UIPresentationController {
}

@objc func didTapBackgroundView() {
presentable?.didTapOrSwipeToDismiss()
// This animation isn't cleanly interruptable, don't allow dismissal until it completes.
// We're not aware of the animation state ourselves, so we'll check the presentedView for any attached animations.
if presentedView.layer.animationKeys()?.count ?? 0 == 0 {
presentable?.didTapOrSwipeToDismiss()
}
}
}

Expand Down

0 comments on commit 510781d

Please sign in to comment.