fix: pick up proper ViewController
for KeyboardToolbar
when modal is shown
#514
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📜 Description
Fixes incorrect button state if
KeyboardToolbar
is used inside the modal window.💡 Motivation and Context
The problem was because of the fact that when modal is shown we still retrieve the
rootView
. As a result we searched for other inputs (not these that user currently see) and the state of button was broken.To overcome this problem I decided to search for current active view controller (i. e. modal if it's shown). For that I created an
UIApplication
extension. It worked, but I noticed one bug (actually e2e tests caught that) - when contact modal is shown and you select the contact, then you move focus to the next input and both arrows should be active. However the state gets broken. It happens because of the fact that we try to search for inputs in modal that has been dismissed. To fix this problem I decided to take only visible modals into consideration and fixed the problem in 095c167Closes #510
📢 Changelog
iOS
UIApplication
extension;UIApplication.topViewController
instead ofrootViewController
.🤔 How Has This Been Tested?
tested manually on iPhone 15 Pro + e2e tests.
📸 Screenshots (if appropriate):
📝 Checklist