Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pick up proper ViewController for KeyboardToolbar when modal is shown #514

Merged
merged 7 commits into from
Jul 19, 2024

Conversation

kirillzyusko
Copy link
Owner

@kirillzyusko kirillzyusko commented Jul 18, 2024

📜 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 095c167

Closes #510

📢 Changelog

iOS

  • added new UIApplication extension;
  • linked new extension to unit tests project;
  • started to use UIApplication.topViewController instead of rootViewController.

🤔 How Has This Been Tested?

tested manually on iPhone 15 Pro + e2e tests.

📸 Screenshots (if appropriate):

📝 Checklist

  • CI successfully passed
  • I added new mocks and corresponding unit-tests if library API was changed

@kirillzyusko kirillzyusko added 🍎 iOS iOS specific 🌎 modal Anything that involves Modal usage KeyboardToolbar Anything related to KeyboardToolbar component labels Jul 18, 2024
@kirillzyusko kirillzyusko self-assigned this Jul 18, 2024
Copy link
Contributor

github-actions bot commented Jul 18, 2024

📊 Package size report

Current size Target Size Difference
145955 bytes 145744 bytes 211 bytes 📈

@kirillzyusko kirillzyusko marked this pull request as ready for review July 19, 2024 09:01
@kirillzyusko kirillzyusko changed the title fix: correctly pick up ViewController when modal is shown fix: pick up proper ViewController for KeyboardToolbar when modal is shown Jul 19, 2024
@kirillzyusko kirillzyusko merged commit 1e446dc into main Jul 19, 2024
12 checks passed
@kirillzyusko kirillzyusko deleted the fix/view-traverse-when-modal-shown branch July 19, 2024 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍎 iOS iOS specific KeyboardToolbar Anything related to KeyboardToolbar component 🌎 modal Anything that involves Modal usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] Modal + KeyboardToolbar = incorrect arrows state
1 participant