-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Fix KeyboardAvoidingView to keep frame height #29239
Conversation
…dingView's behavior is height
Hi @shunwitter! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Base commit: 23fbfc1 |
Base commit: 23fbfc1 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
4 similar comments
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
3 similar comments
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
2 similar comments
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@shunwitter Thanks! Works for me. |
@vomchik I guess it's already fixed thanks to this commit. |
I'm still experiencing this in 0.66. Is there a way to work around this issue except using another |
Hi @shunwitter I'm resuming this PR from 1 year ago, because we're facing this exact issue and it looks like that so far the only reasonable fix is yours. You said that the issue had been fixed in another commit, but after checking it thoroughly it doesn't seem the case. Latest code, on master, still doesn't include the key change you proposed in this PR, and none of the changes from the commit you referenced to as the fix seem to address this particular issue. UPDATE: it looks like the commit referenced as fix actually seemed to 'resolve' that particular issue, but it was just masking it behind an even worse issue, which was then fixed in a subsequent commit (6730927), which in turns made the original issue happen again. |
hi @krskrs, I recently noticed this issue still exists when I create a new react-native project. I have been using my version of KeyboardAvoidingView component but maybe I can create a new PR for this. |
Hi @shunwitter ! I have been working on a small variation of this fix. The core principle is the same, but I also tried to use a more accurate height than the one simply captured on first onLayout event, because, in some cases, I have seen multiple consecutive onLayout events with slightly different height values occurring just after component instantiation. Moreover, just in case there were external causes which might cause the base frame height to change, I try to keep it updated, as, again, using the initial value won't be enough in such cases. https://gist.github.com/krskrs/4a3d347a8a42435e74dc32b8c3abe93b |
Thank for sharing it, @krskrs . I'll try that out :) |
@shunwitter thank you. When you do it, feel free to comment or ask anything, if you want. Any comment or suggestion would be appreciated. ;) Meanwhile I will keep it updated in case we make any further changes. |
Summary
KeyboardAvoidingView
There is an issue like below when
behavior="height"
is selected.KeyboardAvoidingView stops working when you change input type (e.g. from English to Emoji).
This is how to reproduce the issue.
KeyboardAvoidingView behavior="height"
KeyboardAvoidingView
goes back to the original height, therefore nested elements return to the original position.Related issue: #26293
KeyboardAvoidingViewExample
Added
height
option example in RNTester.Changelog
[General] [Fixed] - Fix KeyboardAvoidingView's behavior "height"
Test Plan
Before
After