NervJS / taro-ui

一款基于 Taro 框架开发的多端 UI 组件库
https://taro-ui.taro.zone
MIT License
4.53k stars 758 forks source link

Input输入框 onInput事件触发setData后,会自动收起键盘,导致不能连续输入 #1806

Closed tianguzhe closed 3 months ago

tianguzhe commented 3 months ago

问题描述 Input输入框 onInput事件触发setData后,会自动收起键盘

复现步骤

import { useState } from "react";
import { Input, View } from "@tarojs/components";

const TestPage = () => {
  const [inputValue, setInputValue] = useState("");

  const handleInput = (e) => {
    setInputValue(e.detail.value);
  };

  const SearchBar = () => {
    return (
      <Input
        type="text"
        value={inputValue}
        onInput={handleInput}
        placeholder="请输入私教动作名称"
        focus={true} // 确保 Input 组件在初始化时获取焦点
      />
    );
  };

  return (
    <View>
      <View
        style={{
          height: 100,
        }}
      />
      <SearchBar />
    </View>
  );
};

export default TestPage;

期望行为

能持续输入文字,不要中断输入

taro-ui-bot[bot] commented 3 months ago

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

tianguzhe commented 3 months ago

提交错了仓库