capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

Keyboard height is inconsistent

Open TheotimeColin opened this issue 1 year ago • 1 comments

Bug Report

Plugin(s)

@capacitor/keyboard: 6.0.0

Capacitor Version

Latest Dependencies:
  @capacitor/cli: 6.1.2
  @capacitor/core: 6.1.2
  @capacitor/android: 6.1.2
  @capacitor/ios: 6.1.2

Installed Dependencies:
  @capacitor/cli: 6.1.2
  @capacitor/core: 6.0.0
  @capacitor/ios: 6.1.2
  @capacitor/android: 6.1.2

Platform(s)

Android 14

Current Behavior

keyboardHeight from Keyboard eventListener reports inconsistent values. When I click on an input, the height can be correct, much inferior to the actual height or 0. It seems be basically random.

This did not happen before (maybe an Android update?). I'm using the default keyboard on a Google Pixel.

Expected Behavior

keyboardHeight returns the correct keyboard height.

Code Reproduction

export const initKeyboard = () => {
  const onShow = (info: KeyboardInfo) => {
    console.log('KHEIGHT : ', info.keyboardHeight)
    // Logs 383 (correct), 48 (incorrect) or 0 (incorrect)

    height.value = info.keyboardHeight
  }

  if (Capacitor.isPluginAvailable('Keyboard') && Capacitor.isNativePlatform()) {
    Keyboard.addListener('keyboardWillShow', info => onShow(info))
    Keyboard.addListener('keyboardDidShow', info => onShow(info))
  }

  return { onShow, onHide }
}

TheotimeColin avatar Oct 09 '24 14:10 TheotimeColin

This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed.

Please see the Contributing Guide for how to create a Sample App.

Thanks! Ionitron 💙

Ionitron avatar Oct 16 '24 08:10 Ionitron

It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.

Have a great day! Ionitron 💙

Ionitron avatar Nov 01 '24 00:11 Ionitron

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Nov 16 '24 00:11 ionitron-bot[bot]