react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Keyboard Avoiding View Layout Problem on Orientation Change

Open Prajwaltechversant opened this issue 8 months ago • 8 comments

Description

When using KeyboardAvoidingView in a React Native application, an issue occurs where the lower part of the screen becomes white and unresponsive after performing the following sequence of actions: rotating the device to landscape mode, opening the keyboard, closing the keyboard, and then rotating back to portrait mode. This behavior disrupts the expected layout and user experience.

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.

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

na

Reproducer

https://snack.expo.dev/b_19gzvJALVnCDLyurUTS

Screenshots and Videos

No response

Prajwaltechversant avatar Apr 15 '25 11:04 Prajwaltechversant

[!TIP] Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.78.2. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

react-native-bot avatar Apr 15 '25 11:04 react-native-bot

[!TIP] Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

react-native-bot avatar Apr 15 '25 11:04 react-native-bot

I have tried in 0.79.0 , still it is same

Prajwaltechversant avatar Apr 15 '25 11:04 Prajwaltechversant

i got the issue in the example provided by react native itself

Prajwaltechversant avatar Apr 15 '25 11:04 Prajwaltechversant

@Prajwaltechversant thanks for the issue. If this is happening on both 0.78 and 0.79, it is not a regression.

<KeyboardAvoidingView> is a component that behaves weirdly. I strongly suggest you to look into react-native-keyboard-controller as it solves a lot of issues.

We are going to look into this, but we can't commit to a timeline.

cipolleschi avatar Apr 15 '25 12:04 cipolleschi

@cipolleschi thanks for the reply , i will check that

Prajwaltechversant avatar Apr 15 '25 12:04 Prajwaltechversant

@cipolleschi any resolution yet? This issue is happening on ios as well. Can we have a quickfix till the time it is not available in upcoming releases?

1880akshay avatar Jun 21 '25 14:06 1880akshay

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 avatar Dec 19 '25 05:12 react-native-bot

This issue was closed because it has been stalled for 7 days with no activity.

react-native-bot avatar Dec 26 '25 05:12 react-native-bot