taro icon indicating copy to clipboard operation
taro copied to clipboard

Taro.onKeyboardHeightChange 方法中 Height 值返回错误

Open AntoninSorrento opened this issue 1 year ago • 0 comments

相关平台

React Native

使用框架: React

复现步骤

// 监听键盘弹起
useEffect(() => {
    Taro.onKeyboardHeightChange(res => {
        console.log('height:',res.height)
        

    })

}, []);

期望结果

res.height 的值,根据键盘打开,关闭后,给出正确的值

实际结果

只要打开一次键盘,永远会返回键盘打开时的高度,不会返回 0

环境信息

 Taro CLI 3.6.23 environment info:
    System:
      OS: macOS 14.2.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 21.4.0 - ~/.nvm/versions/node/v21.4.0/bin/node
      Yarn: 1.22.21 - /usr/local/bin/yarn
      npm: 10.2.4 - ~/.nvm/versions/node/v21.4.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.23 => 3.6.23 
  @tarojs/components: 3.6.23 => 3.6.23 
      @tarojs/helper: 3.6.23 => 3.6.23 
      @tarojs/plugin-framework-react: 3.6.23 => 3.6.23 
      @tarojs/plugin-platform-alipay: 3.6.23 => 3.6.23 
      @tarojs/plugin-platform-h5: 3.6.23 => 3.6.23 
      @tarojs/plugin-platform-jd: 3.6.23 => 3.6.23 
      @tarojs/plugin-platform-qq: 3.6.23 => 3.6.23 
      @tarojs/plugin-platform-swan: 3.6.23 => 3.6.23 
      @tarojs/plugin-platform-tt: 3.6.23 => 3.6.23 
      @tarojs/plugin-platform-weapp: 3.6.23 => 3.6.23 
      @tarojs/react: 3.6.23 => 3.6.23 
 @tarojs/rn-runner: 3.6.23 => 3.6.23 
      @tarojs/rn-supporter: 3.6.23 => 3.6.23 
      @tarojs/runtime: 3.6.23 => 3.6.23 
      @tarojs/runtime-rn: 3.6.23 => 3.6.23 
      @tarojs/shared: 3.6.23 => 3.6.23 
      @tarojs/taro: 3.6.23 => 3.6.23 
      @tarojs/taro-loader: 3.6.23 => 3.6.23 
      @tarojs/taro-rn: 3.6.23 => 3.6.23 
      @tarojs/webpack5-runner: 3.6.23 => 3.6.23 
      babel-preset-taro: 3.6.23 => 3.6.23 
 eslint-config-taro: 3.6.23 => 3.6.23 
      expo: ~47.0.3 => 47.0.14 
      react: ^18.1.0 => 18.2.0 
      react-native: ^0.70.1 => 0.70.15 

AntoninSorrento avatar Jan 26 '24 07:01 AntoninSorrento