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
{{ message }}
Repository navigation
KeyboardAvoidingView Android white area when keyboard open/close #32612
When using KeyboardAvoidingView on android, whatever the configuration I use for the behavior or the keyboardVerticalOffset I always have a white area when the keyboard is opening or closing while on iOS everything is moving smoothly.
Screenrecorder-2021-11-17-13-15-28-66.mp4
In the video, we can see that when the keyboard opens there is a big white area and when closing sometimes a small white rectangle with some flickering. I'm wondering if this is normal behavior because on iOS it transitions smoothly
I tried modifying android manifest with android:windowSoftInputMode="adjustResize" or android:windowSoftInputMode="adjustPan" but the problem is still there with both config.
It would actually be ok if we could change this color from white to something else like the background color of the content (red in my example). But I couldn't find a way.
Version
0.66
Output of react-native info
It happens from the documentation snack so I guess this section is not necessary
Steps to reproduce
Take the example from the KeyboardAvoidingView of react-native documentation and modify the background color of the container from white to red in order to see the white area when opening/closing the keyboard.
Snack, code example, screenshot, or link to a repository
I fixed this by adding <item name="android:windowBackground">@color/windowBackgroundColor</item> within the styles.xml
Add to android/app/src/main/res/values/styles.xml so it becomes like:
<resources>
<!-- Base application theme. -->
<stylename="AppTheme"parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<itemname="android:editTextBackground">@drawable/rn_edit_text_material</item>
<!-- Add the line here -->
<itemname="android:windowBackground">@color/windowBackgroundColor</item>
</style>
</resources>
Then create android/app/src/main/res/values/colors.xml
I assume non-Expo users can figure out what that's doing and leverage it directly.
This does indeed allow you to change the background color that appears when the keyboard is opened, but my question now is, how do I make it dynamic? I have a light and dark theme, and if I set a static value when the user switches themes, the user experience will still be poor. Thanks for the alternative.
@abrahamgalue does SystemUI.setBackgroundColorAsync() from that link not do it for you? We just call it when the dark/light mode is changed and it works well for us (Expo 52.)
@abrahamgalue does SystemUI.setBackgroundColorAsync() from that link not do it for you? We just call it when the dark/light mode is changed and it works well for us (Expo 52.)
Do you have any examples of how to do this? I'd really appreciate it. I'm new to Expo and would like to fix this visual effect, but I don't know how to implement it.
@Nantris Well, I went back to the Expo Snack and tried Expo Go on my Android 15 device, and I'm still seeing the problem that was reported when the keyboard jumps—there's a white background on a white background
Activity
davram88 commentedon Mar 11, 2024
If you are using expo, try expo-system-ui and set background color. It worked for me!
GrantBartlett commentedon Jul 16, 2024
I fixed this by adding
<item name="android:windowBackground">@color/windowBackgroundColor</item>within thestyles.xmlAdd to
android/app/src/main/res/values/styles.xmlso it becomes like:Then create
android/app/src/main/res/values/colors.xmlCan name
windowBackgroundColorwhatever you want just so it matches the colors.xml name.Nantris commentedon Jul 18, 2024
This makes the app feel so janky and poorly built no matter how much effort was really put into it, and so far I can't find any solution.
iAmHammad261 commentedon Sep 8, 2024
This Fixed my issue ❤
Odyrac commentedon Nov 15, 2024
+1 no solution find
Nantris commentedon Nov 23, 2024
If you use Expo I'm pretty sure this is the solution: https://docs.expo.dev/versions/latest/sdk/system-ui/#systemuisetbackgroundcolorasynccolor
I assume non-Expo users can figure out what that's doing and leverage it directly.
abrahamgalue commentedon Apr 10, 2025
This does indeed allow you to change the background color that appears when the keyboard is opened, but my question now is, how do I make it dynamic? I have a light and dark theme, and if I set a static value when the user switches themes, the user experience will still be poor. Thanks for the alternative.
Nantris commentedon Apr 11, 2025
@abrahamgalue does
SystemUI.setBackgroundColorAsync()from that link not do it for you? We just call it when the dark/light mode is changed and it works well for us (Expo 52.)abrahamgalue commentedon Apr 11, 2025
Do you have any examples of how to do this? I'd really appreciate it. I'm new to Expo and would like to fix this visual effect, but I don't know how to implement it.
Nantris commentedon Apr 11, 2025
@abrahamgalue this is probably what you're looking for. You can listen to changes in dark/light and then set your preferred color: https://reactnative.dev/docs/appearance#addchangelistener
react-native-bot commentedon Oct 9, 2025
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
abrahamgalue commentedon Oct 9, 2025
The problem persists
Nantris commentedon Oct 9, 2025
@abrahamgalue on what Android version? I think this is an Android problem with React Native and it seems resolved on newer versions of Android.
abrahamgalue commentedon Oct 9, 2025
@Nantris Well, I went back to the Expo Snack and tried Expo Go on my Android 15 device, and I'm still seeing the problem that was reported when the keyboard jumps—there's a white background on a white background
Nantris commentedon Oct 9, 2025
I don't know if Expo Go is a valid test for this.
Try this to set the background color of the native root component (I guess is what this does) and make a custom dev client build and if you still see it then it's definitely still an issue: https://docs.expo.dev/versions/latest/sdk/system-ui/#systemuisetbackgroundcolorasynccolor
abrahamgalue commentedon Oct 10, 2025
@Nantris Yes, that works. Although I can't stop thinking about how a developer who doesn't use Expo, only React Native as a library, would do it.
Nantris commentedon Oct 10, 2025
Glad to hear it!
I think these are the underlying native functions:
https://github.com/expo/expo/blob/27b2a908664cc5521961a65709dcb8c7e03e54ec/packages/expo-system-ui/ios/ExpoSystemUI/ExpoSystemUIModule.swift#L42
https://github.com/expo/expo/blob/27b2a908664cc5521961a65709dcb8c7e03e54ec/packages/expo-system-ui/android/src/main/java/expo/modules/systemui/SystemUIModule.kt#L40
react-native-bot commentedon Apr 9, 2026
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
react-native-bot commentedon Oct 8, 2026
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
react-native-bot commentedon Oct 15, 2026
This issue was closed because it has been stalled for 7 days with no activity.