如何通过按Tab键将新项目添加到多选列表中?

时间:2018-06-26 20:29:25

标签: reactjs react-bootstrap-typeahead

我添加了自动完成功能,因此即使我允许,它也会选择选项中的项目,但会选择新项目。

如果我键入的项目不在列表中,则用户必须先按向上箭头,然后再按Tab键才能使其正常工作。

有什么方法可以只按Enter键。

它似乎也与此项目有关: Configurable "Complete Hint" Key Configuration

不幸的是,我无法弄清楚如何在HOC中做到这一点来进行选择。我尝试从事件处理程序中传入keyDownEvent,但无法弄清楚如何在状态下进行选择。

编辑: 回购演示页面中的代码

class CustomSelectionsExample extends React.Component {
  render() {
    return (
      <Typeahead
        allowNew
        multiple
        newSelectionPrefix="Add a new item: "
        options={[]}
        placeholder="Type anything..."
      />
    );
  }
}

0 个答案:

没有答案