Closed kirillzyusko closed 1 month ago
Current size | Target Size | Difference |
---|---|---|
145744 bytes | 144411 bytes | 1333 bytes 📈 |
PR Preview Action v1.4.7 :---: Preview removed because the pull request was closed. 2024-07-18 12:06 UTC
The latest updates on your projects. Learn more about Argos notifications ↗︎
Build | Status | Details | Updated (UTC) |
---|---|---|---|
default (Inspect) | 👍 Changes approved | 2 changed | Jul 18, 2024, 11:22 AM |
📜 Description
KeyboardAwareScrollView
is reacting on text selection now.💡 Motivation and Context
Sometimes users may scroll up, and then they may want to select part of the text. If the text is hidden under the keyboard, then they do not need what to select, they have to scroll themself, and it makes UX worse. In this PR we automatically detect selection event and scroll down to make sure selected text is visible.
Initially I wanted to scroll in the same manner as we do for text change - i.e. just scroll to make TextInput to be above the keyboard. While it works I thought on how it could be improved: since we have selection coordinates we can re-use them and rely on them instead of the height of the input. In this case we will scroll only for selection distance. I experimented a little bit with this approach, it works so I decided to stick to it.
Closes https://github.com/kirillzyusko/react-native-keyboard-controller/issues/420
📢 Changelog
JS
scrollFromCurrentPosition
function;scrollFromCurrentPosition
inonChangeText
andonSelectionChange
handlers;iOS
Android
Docs
E2E
🤔 How Has This Been Tested?
Tested on iPhone 15 Pro, Pixel 2 (API 28, API 31).
📸 Screenshots (if appropriate):
📝 Checklist