[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

shunwitter
Copy link
@shunwitter shunwitter commented Jun 28, 2020

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.

  • Use KeyboardAvoidingView behavior="height"
  • Focus input field
  • Keyboard appears
  • Change keyboard type
  • 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

KeyAvoidingView-demo

After

Fixed

@facebook-github-bot
Copy link
Contributor

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!

@analysis-bot
Copy link
analysis-bot commented Jun 28, 2020
Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 23fbfc1

@analysis-bot
Copy link
analysis-bot commented Jun 28, 2020
Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 6,765,187 2,228
android hermes armeabi-v7a 6,428,407 2,221
android hermes x86 7,152,329 2,213
android hermes x86_64 7,042,314 2,230
android jsc arm64-v8a 8,938,505 3,157
android jsc armeabi-v7a 8,594,117 3,167
android jsc x86 8,768,781 3,156
android jsc x86_64 9,344,379 3,152

Base commit: 23fbfc1

@react-native-bot react-native-bot added the No CLA Authors need to sign the CLA before a PR can be reviewed. label Jun 29, 2020
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 30, 2020
@react-native-bot react-native-bot removed the No CLA Authors need to sign the CLA before a PR can be reviewed. label Jun 30, 2020
@facebook-github-bot
Copy link
Contributor

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
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

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
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@shunwitter shunwitter changed the title Prevent keyboard disappearing when input type changes if KeyboardAvoidingView's behavior is height Fix KeyboardAvoidingView to keep frame height Jun 30, 2020
@facebook-github-bot
Copy link
Contributor

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
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@vomchik
Copy link
vomchik commented Oct 14, 2020

@shunwitter Thanks! Works for me.
Could you fix conflicts?

@shunwitter
Copy link
Author

@vomchik I guess it's already fixed thanks to this commit.

@shunwitter shunwitter closed this Nov 23, 2020
@stefblokdijk
Copy link

I'm still experiencing this in 0.66. Is there a way to work around this issue except using another behavior option?

@krskrs
Copy link
krskrs commented Dec 9, 2021

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.
Currently we have 'forked' this component and we're using our version, with a fix identical to yours, but we believe this issue should be resumed and taken into consideration b/c it's a quite relevant one.
Can I ask you if you have kept using your patched code? Or if you just have stopped using react native and lost the interest in this PR, as we're almost 100% sure the issue is still there.

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.

@shunwitter
Copy link
Author

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.

@krskrs
Copy link
krskrs commented Dec 10, 2021

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

@shunwitter
Copy link
Author

Thank for sharing it, @krskrs . I'll try that out :)

@krskrs
Copy link
krskrs commented Dec 10, 2021

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants