refactor: guard `KeyboardLayoutGuide` path through config (instead of direct checks) (#1517)
## 📜 Description Make configuration for `KeyboardTrackingView`. ## 💡 Motivation and Context In `1.22.x` I want to re-write the algorithm for tracking keyboard (yes, again) and switch back to legacy path (it looks like I found a better way of managing things and I can deliver better experience than `KeyboardLayoutGuide`). But at the same time I don't want to drop the current code with `KeyboardLayoutGuide`. So I decided to hide it under feature flag. If users discover regressions - they can just toggle feature flag and restore old behavior. Also in future if my method stops to work again I can also toggle feature flag and use modern path (when `KeyboardLayoutGuide` will be stable). To achieve this I added `KeyboardControllerConfiguration` with `usesKeyboardLayoutGuideTracking` field. And repalced corresponding `#available(iOS 26.0, *)` condition to `usesKeyboardLayoutGuideTracking` field. Such code helps us: - reduce code fragmentation; - control things from one place; - simplify the codebase and maintenance in the future. While refactoring it I also realised that we don't need to attach invisible `KeyboardLayoutGuide` on older iOS versions so I also guarded this code with `usesKeyboardLayoutGuideTracking` flag. ## 📢 Changelog <!-- High level overview of important changes --> <!-- For example: fixed status bar manipulation; added new types declarations; --> <!-- If your changes don't affect one of platform/language below - then remove this platform/language --> ### iOS - added `KeyboardControllerConfiguration` file; - guard `KeyboardLayoutGuide` code under `usesKeyboardLayoutGuideTracking` flag; ## 🤔 How Has This Been Tested? Tested via e2e test. ## 📸 Screenshots (if appropriate): <img width="777" height="313" alt="Screenshot 2026-06-26 at 17 51 28" src="https://github.com/user-attachments/assets/d1f24f3d-509f-4dfa-a914-a9413ca84b25" /> ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
K
Kirill Zyusko committed
918254a8daab95a6f95d7cb7e67b0f445b01044d
Parent: 83e622e
Committed by GitHub <noreply@github.com>
on 6/26/2026, 4:08:59 PM