微信小程序
https://github.com/without-yy/taro_issue_demo_input
小程序基础库: 2.12.0
使用框架: React
真机调试即可复现, 使用原生小程序测试没有此bug, 重现git地址中有一段mp4可以观看
onFocus 时 键盘弹起一次
onFocus 时 键盘弹起两次
👽 Taro v3.0.2
Taro CLI 3.0.2 environment info:
System:
OS: macOS 10.15.5
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.4.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
npmPackages:
@tarojs/components: 3.0.2 => 3.0.2
@tarojs/mini-runner: 3.0.2 => 3.0.2
@tarojs/react: 3.0.2 => 3.0.2
@tarojs/runtime: 3.0.2 => 3.0.2
@tarojs/taro: 3.0.2 => 3.0.2
@tarojs/webpack-runner: 3.0.2 => 3.0.2
babel-preset-taro: 3.0.2 => 3.0.2
eslint-config-taro: 3.0.2 => 3.0.2
react: ^16.10.0 => 16.13.1
在 onFocus 里面再 set 一次 focus 这个逻辑去掉还会有吗?
@hlouis 去掉以后就没这个问题了,改成class组件也还是会弹出两次
受控模式下键盘会弹起两次,非受控下正常
这个问题目前在iOS设备上不影响正常使用,但是在安卓设备上第二次键盘不会弹出来,导致无法正常使用。具体可以参考我在taro-ui提的issue,里面有动态图片演示
https://github.com/NervJS/taro-ui/issues/1151
我通过调试AtSearchBar的代码,发现问题在于设置Input组件的focus为true的时候,会发生抖动,通过监听onFocus可以发现抖动不止两次,可能会发生好多次。
升级到3.0.7版本同样也有问题,小米手机上测试键盘会弹出两次。 密码框在用华为手机登录时,无法弹出键盘。
这个问题有解决方案了没有?
在IOS手机上,键盘会弹出两次,
在红米手机上,键盘会不停的打开消失。
<AtSearchBar
actionName='搜一下'
value={this.state.pagedRequest.filter}
onChange={this.onSearchChange.bind(this)}
onActionClick={this.onSearchClick.bind(this)}
onClear = {() => this.onSearchClear()}
onConfirm = {this.onSearchClick.bind(this)}
/>
各位升级到最新版后再试试,在 3.0.15 试了楼主的 demo 或 AtSearchBar,在安卓或 iOS 都没有复现键盘重复弹出的问题了。
升级3.0.15后正常
Most helpful comment
这个问题目前在iOS设备上不影响正常使用,但是在安卓设备上第二次键盘不会弹出来,导致无法正常使用。具体可以参考我在taro-ui提的issue,里面有动态图片演示
https://github.com/NervJS/taro-ui/issues/1151
我通过调试AtSearchBar的代码,发现问题在于设置Input组件的focus为true的时候,会发生抖动,通过监听onFocus可以发现抖动不止两次,可能会发生好多次。