-
-
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
Enabled does not work as expected #414
Comments
Hi @flodlc 👋
May I ask you to provide more input here? What is the exact scenario which is not working? When |
Hi @kirillzyusko, sure I recorded 2 videos to show you 2 cases of behavior that I have. On this video, I wrap my form with To manage it, I set the const delayedTrue = useDelayed(1000);
return
(<KeyboardAwareScrollView
enabled={delayedTrue}
bottomOffset={10}
keyboardShouldPersistTaps="handled"
>
{...}
</KeyboardAwareScrollView>
); So to resume, the problem is that setting enabled after 1 second does not enables the |
@flodlc cool, I understand the second problem now, thanks for sharing videos ❤️ This is a definetely bug - I'll try to fix it. I think a fix may be similar to #399 but may need to adjust code in Thank you for reporting this problem! I'll try to fix it next week 👍
I'm always open for discussions and any suggestions for the code changes in my library 👀 Though i think a problem is a bit tricky to solve (because you are animating a view + change a size of this view). But yeah, anyway, I'm open for discussions and potential ways to resolve the problem 👀 |
Nice, if you need more details feel free to ask. |
It works absolutely how it should ! |
…AwareScrollView`) (#417) ## 📜 Description React on `enabled` property toggle when keyboard open in `KeyboardAwareScrollView` component. ## 💡 Motivation and Context Initially me and @IvanIhnatsiuk were thinking that in #350 it will be better to not handle keyboard appearance if `enabled=false`. But it turns out that it will produce issues like #414 So in this PR I'm always keeping a handler in `useKeyboardHandler` hook and instead I don't render additional padding if view is disabled (we are not making any scrolling because we already handle `enabled` property value in `maybeScroll`). Fixes #414 ## 📢 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 --> ### JS - don't put keyboard handlers conditionally; - make padding conditional depends on `enabled` property; ## 🤔 How Has This Been Tested? Tested manually on iPhone 15 Pro (iOS 17.4, simulator). ## 📸 Screenshots (if appropriate): <!-- Add screenshots/video if needed --> <!-- That would be highly appreciated if you can add how it looked before and after your changes --> |Before|After| |-------|-----| |![image](https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/e37f7dbc-b915-4f6c-993d-7b672672be66)|![image](https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/44127abe-4353-4aff-abf3-aa69491e5383)| |<video src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/54de59f6-4f5e-45cd-ae4b-aa34cea6f56c">|<video src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/4e4fccf0-9c1e-4a94-a12e-17a8412b2244">| ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
@flodlc thanks, glad to hear it works! I may release a new library version next week, but if it's blocking you -> you can apply changes from this PR using a |
Published in |
Hi there,
I use
enabled
property in case of autofocus of an input in a modal context. I do it to prevent the keyboard opening competing with the modal height transition which leads to broken animation.I delay the activation of
KeyboardAwareScrollView
usingenabled: false
and thentrue
after 1 second of delay.The animation works but the
KeyboardAwareScrollView
is not working until I blur the input (keyboard collapse) and reopen it.Hope it helps :)
To Reproduce
Steps to reproduce the behavior:
For the delay I use this hook:
Expected behavior
After enabled turns on, it should work as usual.
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: