Skip to content

Commit

Permalink
Merge pull request #671 from Adyen/fix-layouting-freez
Browse files Browse the repository at this point in the history
fix: Fixes a bug where sometimes form views freezes while layouting
  • Loading branch information
mohammedDehairy authored Oct 13, 2021
2 parents 4f26ed0 + d3ab9d6 commit 400f57d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
14 changes: 7 additions & 7 deletions Adyen/Helpers/UIViewHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ extension AdyenScope where Base: UIView {
duration: 0.35,
delay: 0,
options: [.calculationModeCubicPaced, .beginFromCurrentState],
animations: {
animations: { [weak base] in
UIView.addKeyframe(withRelativeStartTime: hidden ? 0.5 : 0, relativeDuration: 0.5) {
self.base.isHidden = hidden
base?.isHidden = hidden
}
UIView.addKeyframe(withRelativeStartTime: hidden ? 0 : 0.5, relativeDuration: 0.5) {
self.base.alpha = hidden ? 0 : 1
base?.alpha = hidden ? 0 : 1
}
}, completion: { _ in
self.base.isHidden = hidden
self.base.alpha = hidden ? 0 : 1
self.base.adyen.updatePreferredContentSize()
}, completion: { [weak base] _ in
base?.isHidden = hidden
base?.alpha = hidden ? 0 : 1
base?.adyen.updatePreferredContentSize()
})
animate(context: context)
}
Expand Down
1 change: 1 addition & 0 deletions Adyen/UI/Form/Items/Text/FormTextItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ open class FormTextItemView<ItemType: FormTextItem>: FormValueItemView<String, F

/// :nodoc:
override public func validate() {
guard !isHidden else { return }
updateValidationStatus(forced: true)
}

Expand Down
8 changes: 4 additions & 4 deletions Adyen/UI/Form/Items/Value/FormValueItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ open class FormValueItemView<ValueType, Style, ItemType: FormValueItem<ValueType
let context = AnimationContext(animationKey: Animation.separatorHighlighting.rawValue,
duration: 0.0,
delay: 0.0,
animations: {
self.separatorView.backgroundColor = self.item.style.separatorColor
animations: { [weak self] in
self?.separatorView.backgroundColor = self?.item.style.separatorColor
},
completion: { _ in
self.separatorView.backgroundColor = self.item.style.separatorColor
completion: { [weak self] _ in
self?.separatorView.backgroundColor = self?.item.style.separatorColor
})

adyen.animate(context: context)
Expand Down

0 comments on commit 400f57d

Please sign in to comment.