From ca685ce3d295bff6ee0cca357af90fa473480da1 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Mon, 4 Nov 2019 19:10:02 +0400 Subject: [PATCH] Wallet: fix scrolling to last input field --- .../WalletUI/Sources/WalletWordCheckScreen.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/submodules/WalletUI/Sources/WalletWordCheckScreen.swift b/submodules/WalletUI/Sources/WalletWordCheckScreen.swift index 86152a7da9..e66231cc9c 100644 --- a/submodules/WalletUI/Sources/WalletWordCheckScreen.swift +++ b/submodules/WalletUI/Sources/WalletWordCheckScreen.swift @@ -2731,14 +2731,12 @@ private final class WalletWordCheckScreenNode: ViewControllerTracingNode, UIScro guard let strongSelf = self else { return } - if node.isLast { - if done { - action() + if let index = strongSelf.inputNodes.firstIndex(where: { $0 === node }) { + if index == strongSelf.inputNodes.count - 1 { + if done { + action() + } } else { - strongSelf.scrollNode.view.scrollRectToVisible(strongSelf.buttonNode.frame.insetBy(dx: 0.0, dy: -20.0), animated: true) - } - } else { - if let index = strongSelf.inputNodes.firstIndex(where: { $0 === node }), index != strongSelf.inputNodes.count - 1 { strongSelf.inputNodes[index + 1].focus() } } @@ -2749,7 +2747,9 @@ private final class WalletWordCheckScreenNode: ViewControllerTracingNode, UIScro return } if node.isLast { - strongSelf.scrollNode.view.scrollRectToVisible(strongSelf.buttonNode.frame.insetBy(dx: 0.0, dy: -10.0), animated: true) + UIView.animate(withDuration: 0.3, animations: { + strongSelf.scrollNode.view.scrollRectToVisible(strongSelf.buttonNode.frame.insetBy(dx: 0.0, dy: -20.0), animated: false) + }) } else { strongSelf.scrollNode.view.scrollRectToVisible(node.frame.insetBy(dx: 0.0, dy: -10.0), animated: true) }