react / react/react-native

KeyboardAvoidingView doesn’t reset properly after closing the keyboard in landscape mode

Open
#50,444 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API: Keyboard Component: KeyboardAvoidingView Issue: Author Provided Repro Newer Patch Available Resolution: PR Submitted
Dominant language
C++
Stars
127k
Forks
25.3k
Avg merge
1d 23h
Merged PRs (30d)
4

Description

Description

When using KeyboardAvoidingView, if you:

Rotate the device to landscape mode.

Open the keyboard.

Close the keyboard.

Rotate back to portrait mode.
Result: The lower part of the screen becomes white and unresponsive.
Expected Behavior
The layout should reset correctly after closing the keyboard.
No blank space should remain after switching back to portrait mode.

Steps to reproduce

Run this code in a React Native project.

Rotate the device to landscape mode.

Open and then close the keyboard.

Rotate back to portrait mode.

Observe that part of the screen turns white and the layout does not reset properly.

{
"name": "StatusBarApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"react": "19.0.0",
"react-native": "0.78.1"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.78.1",
"@react-native/eslint-config": "0.78.1",
"@react-native/metro-config": "0.78.1",
"@react-native/typescript-config": "0.78.1",
"@types/jest": "^29.5.13",
"@types/react": "^19.0.0",
"@types/react-test-renderer": "^19.0.0",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "19.0.0",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
}

React Native Version

0.78.1

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info
System:
  OS: macOS 15.1
  CPU: (8) arm64 Apple M1
  Memory: 116.64 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 23.6.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.2
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23726.103.2422.13103373
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.78.1
    wanted: 0.78.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

info React Native v0.78.2 is now available (your project is running on v0.78.1).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.78.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.78.1&to=0.78.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
Stacktrace or Logs
no crash
Reproducer

https://snack.expo.dev/b_19gzvJALVnCDLyurUTS

Screenshots and Videos

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Snack reproducer and reproduce the Android sequence: landscape rotation, open and close the keyboard, then return to portrait. Trace KeyboardAvoidingView behavior around keyboard dismissal and orientation changes. Done means the layout resets in portrait without a white, unresponsive lower section.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.