-
-
Notifications
You must be signed in to change notification settings - Fork 519
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
Fixing Android keyboard adjustResize not working with status bar tran… #2311
base: main
Are you sure you want to change the base?
Fixing Android keyboard adjustResize not working with status bar tran… #2311
Conversation
@nikhiltekwani09 I don't think it's a great fix. Adding keyboard insets (i. e. keyboard height) as bottom padding doesn't sound right to me (but it's my personal opinion - I'm not a maintainer of RNS, but I added the code that you are modifying). Another question - why do we add keyboard insets only to I also opened a separate issue in another repository: Expensify/react-native-live-markdown#346 The issue may be different but maybe it can give you some insights into where to search for the problem additionally! |
@kirillzyusko the things were working perfectly prior to android R And I have considered the keyboard height using WindowInsetsCompat.Type.ime() as this gives a non 0 value only when the keyboard is opened and we want the height to decrease equivalent to value of keyboard height when it is opened |
Well, my opinion is that it's not a correct approach, because prior to 52f13c6 we were using only If we open a documentation we'll clearly see, that new approach is to use Now we add ime insets, which I think is not a correct solution, because Here is the PR that introduced new API for Android 30+: #1868 But again, it's only my opinion - I would wait for a review from maintainers to see what they say 👀 |
Yes but that is always returning a 0 value and earlier it was returning the keyboard height |
@nikhiltekwani09 well, I checked and it looks like |
Yes that is why I manually added ime insets. Also the issue is happening without fabric as well. |
@nikhiltekwani09 oh, yeah, I see it now. I think potentially a better option would be to combine insets together without involving math operations: val windowInsets = defaultInsets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.ime())
WindowInsetsCompat
.Builder()
.setInsets(
WindowInsetsCompat.Type.systemBars(),
Insets.of(
windowInsets.left,
0,
windowInsets.right,
windowInsets.bottom,
),
).build() But this is really strange, that Android claims to use /**
* @return All system bars. Includes {@link #statusBars()}, {@link #captionBar()} as well as
* {@link #navigationBars()}, but not {@link #ime()}.
*/
@InsetsType
public static int systemBars() {
return STATUS_BARS | NAVIGATION_BARS | CAPTION_BAR;
} Anyway I would wait for a review from SWM team 😅 |
Yes I would also wait for the comments from the maintainers now |
Can we please merge this PR |
…slucent
Description
In android, the adjustResize soft input mode is not working as expected when status bar is set as translucent.
react-native version: 0.74.3
react-native-screens version: 3.34.0
Fixes #2308
Changes
Example where issue is reproducible - https://github.com/1880akshay/RN_NewArch_TextInput/tree/android-keyboard
The change which caused the issue - 52f13c6