You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using Modal component in our app. We usually have its content (dialog) centered, but in one case where text input is included, we have the content pushed up by some pixels to prevent keyboard overlapping it, so it always displays in the top half of the screen.
We want it to behave the same on android and iOS. With setting statusBarTranslucent to true we were able to achieve the consistent behavior on both platforms in previous React Native versions (last one 0.74), because with this setting the modal content didn't react to keyboard visibitily and was able to preserve its position. After upgrading to 0.76.1, the same code started to behave differently. The modal content is now being pushed up automatically when keyboard is open, even if statusBarTranslucent is set to true on android. We want to keep it at the same position regardless of keyboard visibility.
olivertylsar
changed the title
Modal - statusBarTranslucent behaves differently, modal content is pushed up when keyboard open even if set to true
[Android] Modal - statusBarTranslucent behaves differently, modal content is pushed up when keyboard open even if set to true
Nov 8, 2024
Hi @olivertylsar , Thank you fro posting this issue.
I saw that you want the expected result to work on both IOS and Android, but from the documentation, statusBarTranslucent is only supported on Android
I'll try to work on this for the Android side first, then let's see if I can do anything on IOS
@dnhan1707 Yes, on iOS it works fine. The issue is on android, I was able to change the behavior based on the statusBarTranslucent prop in previous React Native versions, which is not the case anymore after the upgrade. You can try it yourself by toggling the statusBarTranslucent prop.
I think it is related to android:windowSoftInputMode="adjustResize", which resizes the content when keyboard opens on android. The question is, if modals should be impacted by that and if they should, is there a possibility to add another prop to set that it should not? I'm not sure if it was intentional before that statusBarTranslucent was changing the behavior in relation to keyboard, but it was a very common suggestion on stackoverflow etc. to use it to achieve it.
Description
We are using
Modal
component in our app. We usually have its content (dialog) centered, but in one case where text input is included, we have the content pushed up by some pixels to prevent keyboard overlapping it, so it always displays in the top half of the screen.We want it to behave the same on android and iOS. With setting
statusBarTranslucent
totrue
we were able to achieve the consistent behavior on both platforms in previous React Native versions (last one 0.74), because with this setting the modal content didn't react to keyboard visibitily and was able to preserve its position. After upgrading to 0.76.1, the same code started to behave differently. The modal content is now being pushed up automatically when keyboard is open, even ifstatusBarTranslucent
is set totrue
on android. We want to keep it at the same position regardless of keyboard visibility.Steps to reproduce
Stacktrace or Logs
Reproducer
https://github.com/olivertylsar/rn-modal-android
Screenshots and Videos
RN 0.74.5 with desired and expected behavior:
RN-0.74.5.mp4
RN 0.76.1 with actual behavior:
RN-0.76.1.mp4
The text was updated successfully, but these errors were encountered: