Skip to content

Commit

Permalink
fix(ad-hoc): code field duplicate views (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-vysotskyi-cko authored May 23, 2023
1 parent 38f2b89 commit 6fff7f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ final class NativeAlternativePaymentMethodCodeInputCell: UICollectionViewCell, N
// MARK: - Private Methods

private func initialize(length: Int) {
if let item, item.length != length {
codeTextField.removeFromSuperview()
if let codeTextField, codeTextField.length == length {
return
}
codeTextField?.removeFromSuperview()
let codeTextField = CodeTextField(length: length)
codeTextField.accessibilityIdentifier = Constants.accessibilityIdentifier
codeTextField.delegate = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ final class CodeTextField: UIControl, UITextInput {
fatalError("init(coder:) has not been implemented")
}

/// Text field length.
let length: Int

weak var delegate: CodeTextFieldDelegate?

var text: String? {
Expand Down Expand Up @@ -341,8 +344,6 @@ final class CodeTextField: UIControl, UITextInput {

// MARK: - Private Properties

private let length: Int

private lazy var contentView: UIView = {
let view = UIView()
view.backgroundColor = .clear
Expand Down

0 comments on commit 6fff7f5

Please sign in to comment.