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

[Android] Content shifting up when keyboard appear #7402

Closed
N3TC4T opened this issue Dec 14, 2021 · 4 comments · Fixed by #7453
Closed

[Android] Content shifting up when keyboard appear #7402

N3TC4T opened this issue Dec 14, 2021 · 4 comments · Fixed by #7453

Comments

@N3TC4T
Copy link
Contributor

N3TC4T commented Dec 14, 2021

🐛 Bug Report

Content always shifting up when keyboard appears, even with setting windowSoftInputMode to adjustNothing.

removing keyboardInsets is a temporary solution but I'm not sure if it will effect other situations or not.

final Insets keyboardInsets = insets.getInsets( WindowInsetsCompat.Type.ime());

To Reproduce

(Write your steps here:)

  1. Set windowSoftInputMode to adjustNothing
  2. Focus on TextInput
  3. Keyboard pushing content to top

Expected behavior

Keyboard visibility should NOT effect content visibility when windowSoftInputMode set to adjustNothing.

Your Environment

  • React Native Navigation version: 7.24.1
  • React Native version: 0.66.1
  • Platform(s): Android
  • Device info: Android Device running SDK 30
@swabbass
Copy link
Contributor

We should take windowSoftInputMode options like adjustNothing into consideration, you are right, soon it will be fixed.

@thuongtv-vn
Copy link

We should take windowSoftInputMode options like adjustNothing into consideration, you are right, soon it will be fixed.

Hi @swabbass Do you know how to android consider "windowSoftInputMode" normally? You are right, we should consider this option as well.

@swabbass
Copy link
Contributor

we might use getActivity().getWindow().getAttributes().softInputMode; and take it into consideration, soon we will have a PR for this

@alan-nakagiri
Copy link

alan-nakagiri commented Jan 14, 2022

Hello! I just wanted to share that I too have seen an issue with windowSoftInputMode and RNN 7.25.0.

Instead my app is set to adjustPan and it does not seem to recognize it, and it is behaving like adjustResize is set instead.

yogevbd added a commit that referenced this issue Feb 12, 2022
# Issue:

Window insets does not apply when keyboard got closed in case of adjustPan, and in case of adjustNothing it will just ignore it and treat it like adjustResize.

The difference between Pan and Resize as pointed [here](https://www.techrepublic.com/article/pro-tip-make-sense-of-pan-vs-resize-in-the-android-manifest/):
adjustResize: The activity’s main window is always resized to make room for the soft keyboard on screen.
adjustPan: The activity’s main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. **This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.**


# Fix:
- Due to the nature of adjustPan, we need to wait for the layout to be updated after the keyboard closed, and then apply insets to determine the final state.
- Take adjustNothing into consideration and don't adjust the insets.

Adjust Nothing:

https://user-images.githubusercontent.com/7227793/153453913-7af3fcb7-87f6-4cfa-aaf8-e2f32b023c61.mov

Adjust Pan:

https://user-images.githubusercontent.com/7227793/153453981-73ccf0c9-e42e-41e3-bede-8f561f9ba53a.mov

AdjustPan old Androids (the white space fixed in master, which is not included in the recorded demo)

https://user-images.githubusercontent.com/7227793/153454164-300c115b-9e7a-407c-b612-c0ca8ac158ea.mov



**NOTE:
As checked, if flags are set to adjustResize, then there is no issue at all across all versions.**


Closes: #7433.
Closes: #7427.
Closes: #7428.
Closes: #7402.


Co-authored-by: Yogev Ben David <yogev132@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants