Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## 📜 Description Fixed a problem of non-working `KeyboardToolbar` functionality inside of `Modal` on Android. ## 💡 Motivation and Context The problem comes from the fact, that `Modal` on Android lives in their own `window` hierarchy and as a result `activity?.currentFocus` is always `null` (`currentFocus` is `null`). A similar fix was added to iOS in this [commit](22babd2). On iOS the problem was in fact that we can not retrieve focused input if keyboard is dismissed (unlike Android, because on Android the view still in focus and carret is blinking after even keyboard dismissal). So on Android it was harder to notice that bug (especially when `Modal`s weren't officially supported). So the fix with replacing `.currentFocus` with `FocusedInputHolder.get()` seems to be pretty reliable, because our `FocusedInputHolder` will always hold a reference to currently focused input (doesn't matter which window contains that input, because we attach `OnGlobalFocusChangeListener` to every window). ## 📢 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 --> ### Android - replace `activity?.currentFocus` with `FocusedInputHolder.get()`; ## 🤔 How Has This Been Tested? Tested manually on Pixel 3A (API 33, emulator). ## 📸 Screenshots (if appropriate): |Before|After| |-------|-----| |<video src="https://github.com/user-attachments/assets/f9390eed-f5cb-4e3d-840a-716399527b0b">|<video src="https://github.com/user-attachments/assets/5232d81f-8020-4e9f-a8d1-d145d33d71f1">| ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
- Loading branch information