diff --git a/examples/debug.tsx b/examples/debug.tsx index 9a447e5..7aa8685 100644 --- a/examples/debug.tsx +++ b/examples/debug.tsx @@ -7,7 +7,7 @@ import '../assets/index.less'; const { Option } = Mentions; export default () => ( - + diff --git a/src/Mentions.tsx b/src/Mentions.tsx index 98565ee..28f083d 100644 --- a/src/Mentions.tsx +++ b/src/Mentions.tsx @@ -2,6 +2,7 @@ import classNames from 'classnames'; import useMergedState from 'rc-util/lib/hooks/useMergedState'; import toArray from 'rc-util/lib/Children/toArray'; import KeyCode from 'rc-util/lib/KeyCode'; +import warning from 'rc-util/lib/warning'; import * as React from 'react'; import { useState, useRef } from 'react'; import TextArea from 'rc-textarea'; @@ -75,6 +76,8 @@ const Mentions = React.forwardRef((props, ref) => { defaultValue, children, + open, + // Events validateSearch, filterOption, @@ -99,6 +102,12 @@ const Mentions = React.forwardRef((props, ref) => { ...restProps } = props; + const mergedPrefix = Array.isArray(prefix) ? prefix : [prefix]; + const mergedProps = { + ...props, + prefix: mergedPrefix, + }; + // =============================== Refs =============================== const textareaRef = useRef