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 broken keyboard layout after changing styles #51

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#endif
```
* Custom location snapping in the `RouteController` via the delegate
* Fix: Broken layout due to keyboard presentation after changing styles or presenting a second MapView
* Merged in <https://github.com/maplibre/maplibre-navigation-ios/pull/51>

## 3.0.0 (Jun 15, 2024)
* The `speak` method in `RouteVoiceController` can be used without a given `RouteProgress` or the `RouteProgress` can explicitly ignored so that it will not be added to the voice instruction.
Expand Down
14 changes: 13 additions & 1 deletion MapboxNavigation/StyleManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ open class StyleManager: NSObject {
}

func refreshAppearance() {
for window in UIApplication.shared.windows {
// re-adding the keyboard window views can break layout. See https://github.com/maplibre/maplibre-navigation-ios/issues/50
for window in UIApplication.shared.applicationWindows {
for view in window.subviews {
view.removeFromSuperview()
window.addSubview(view)
Expand Down Expand Up @@ -233,3 +234,14 @@ extension Solar {
}
}
}

extension UIApplication {
var applicationWindows: [UIWindow] {
windows.filter { window in
let className = String(describing: type(of: window))
return !className.contains("UIRemoteKeyboardWindow") &&
!className.contains("UITextEffectsWindow") &&
!className.contains("UIAlertController")
}
}
}
Loading