-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
KeyboardAvoidingView doesn't work as intended on Android 10 #398
Comments
@breakingrobot Interesting! I thought it could be fixed in #391 but it looks like you are using latest version and if the issues is reproducible - it means that it's something else. On your video I see, that on Android 14 keyboard starts to hide, but then appears again, while on Android 10 it always stays on the screen. I'll look into the problem, but as a potential workaround I could suggest you to manually close keyboard before navigating to the next screen ( useEffect(() => {
setTimeout(() => textInputRef.current.focus(), 250);
}, []); I think it should do the trick! But I'll try to allocate some time and look into the problem 👀 |
@kirillzyusko Thanks for your quick answer, just to let you know I had a workaround with I then tried with delaying focus with a Using useFocusEffect(
useCallback(() => {
setTimeout(() => inputRef?.current?.focus(), 250);
}, []),
); This seems to do the trick right now, again thank you for your time to look into the problem! |
## 📜 Description Consume context values (as default values). ## 💡 Motivation and Context When we navigate between screens, sometimes there can be a situation, where keyboard is not moving. If we initialize values as a default one - we'll have incorrect layout, because keyboard is actually shown (and wasn't moved) so we will continue to use default values (keyboard closed) while keyboard is actually open. To fix this problem I specify default values from the context - context always holds a current values. It fixes the problem 🙂 Closes #398 ## 📢 Changelog ### JS - consume context values as a default one ## 🤔 How Has This Been Tested? Tested on Android 10. ## 📸 Screenshots (if appropriate): |Before|After| |-------|----| |<img width="346" alt="image" src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/a28befcd-c52b-4db8-9ea9-4227b4067028">|<img width="347" alt="image" src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/d40e38de-2dfb-4079-9675-51d014b6c027">| ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
Describe the bug
On an Android 10 React Native app using a multi-step form with two screens that include an autofocused
TextInput
, anyrouter.navigate
orrouter.push
will succeed but the following will happenKeyboardAvoidingView
does not apply the padding expected.Repo for reproducing
https://github.com/breakingrobot/react-native-keyboard-controller/tree/android-10-bug
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Behavior that exhibit any Android devices with Android 11 and higher :
KeyboardAvoidingView
should trigger its animation and apply the correct paddingScreenshots
Android 10 - SDK 29
Enregistrement.de.l.ecran.2024-03-21.a.18.53.16.mp4
Android 14 - SDK 34
Enregistrement.de.l.ecran.2024-03-21.a.18.56.28.mp4
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: