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

`keyboardDidChangeFrame` and `keyboardWillChangeFrame` not fires on Android

Open taeyoon0137 opened this issue 1 year ago • 7 comments

Description

When changing Android's Keyboard height changes, both keyboardDidChangeFrame and keyboardWillChangeFrame does not fired. Also, <KeyboardAvoidingView /> does not apply this height change.

Steps to reproduce

  1. Install the application with 'yarn android'
  2. Open the application with android device.
  3. Select first input(keyboardType="email")
  4. Select second input(keyboardType="numeric")
  5. You can see KeyboardAvoidingView's padding(or height) does not changed, and also event not fired.
  6. This also happens when you change keyboard to emoji keyboard.

React Native Version

0.73.6

Affected Platforms

Runtime - Android

Output of npx react-native info

WARNING: You should run npx react-native@latest to ensure you're always using the most current version of the CLI. NPX has cached version (0.73.6) != current release (0.74.0)
  
info Fetching system and libraries information...
System:
  OS: macOS 14.4.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 153.73 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.5.1
    path: ~/.nvm/versions/node/v20.5.1/bin/node
  Yarn:
    version: 4.0.2
    path: ~/.nvm/versions/node/v20.5.1/bin/yarn
  npm:
    version: 10.2.1
    path: ~/.nvm/versions/node/v20.5.1/bin/npm
  Watchman:
    version: 2024.03.25.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "33"
      - "34"
    Build Tools:
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-33 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

info React Native v0.74.0 is now available (your project is running on v0.73.6).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.74.0
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.74.0
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".

Stacktrace or Logs

-

Reproducer

https://snack.expo.dev/NySnoeN9qggfNwiGi5hyg

Screenshots and Videos

No response

taeyoon0137 avatar Apr 23 '24 05:04 taeyoon0137

:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.73.7. 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.

github-actions[bot] avatar Apr 23 '24 05:04 github-actions[bot]

⚠️ Newer Version of React Native is Available! ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - 0.73.7. 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.

On snack, issue occurs with newest version

taeyoon0137 avatar Apr 23 '24 05:04 taeyoon0137

Is there any progress?

Or at least remove the New Patch Available tag?

⚠️ Newer Version of React Native is Available! ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - 0.73.7. 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.

On snack, issue occurs with newest version

taeyoon0137 avatar May 16 '24 01:05 taeyoon0137

As per the documentation only keyboardDidShow and keyboardDidHide events are available on Android.

kunalchavhan avatar Jun 13 '24 07:06 kunalchavhan

@kunalchavhan As I mentioned, the core issue is that the KeyboardAvoidingView is not responding to changes in Android keyboard height due to the absence of the keyboardDidChangeFrame event. Even if it could trigger this event, it still fails to adjust to different keyboard heights when a user switches to an emoji keyboard or other special keyboards, such as a GIF keyboard.

Due to these inconveniences, I feel limited in using the KeyboardAvoidingView provided by React-Native, and am instead using the react-native-keyboard-controller library.

taeyoon0137 avatar Jun 17 '24 00:06 taeyoon0137

same problem for me. switching didn't trigger keyboard change on android + rn 74 Capture d’écran 2024-06-25 à 15 17 41

alainib avatar Jun 25 '24 13:06 alainib

Tested on ReactNative Version : 0.74.1 Couldn't reproduce the issue. Android version : 9 Can you please try upgrading your react-native version.

https://github.com/facebook/react-native/assets/111736628/5b95dc30-4f4b-4617-aeb4-10112ddd134d

deepanshushuklad11 avatar Jul 01 '24 18:07 deepanshushuklad11