ant-design / pro-chat

🤖 Components Library for Quickly Building LLM Chat Interfaces.
https://pro-chat.antdigital.dev
MIT License
586 stars 72 forks source link

✨ feat: 暴露Input.TextArea的ref到inputAreaProps中 #235

Closed songhanlin closed 1 month ago

songhanlin commented 1 month ago

💻 变更类型 | Change Type

🔀 变更说明 | Description of Change

inputAreaProps 中新增reference, 暴露输入框的ref出来

/**
 * 输入框的 props,优先级最高
 */
inputAreaProps?: TextAreaProps & {
  autoCompleteProps?: AutoCompleteProps;
  value?: string;
  onChange?: (value: string) => void;
  reference?: React.Ref<TextAreaRef>;
};

📝 补充信息 | Additional Information

chrome-capture-2024-5-29

songhanlin commented 1 month ago

226

ONLY-yours commented 1 month ago

好神奇,我检查下为什么默认的 ref 传不过来

songhanlin commented 1 month ago

好神奇,我检查下为什么默认的 ref 传不过来

我尝试过打印props, 在进入到AutoCompleteTextArea的时候, 就丢失了, 似乎就丢ref, 别的自定义的都在

ONLY-yours commented 1 month ago

找到问题所在了,是没有使用 react forwardRef 透出,我直接在你分支上改动,感谢你的提示