Skip to content

Commit 86985c7

Browse files
committed
fix(TagInput): resolve issue of input text overlapping with suffixIcon
1 parent 071a1a7 commit 86985c7

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

packages/components/tag-input/TagInput.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,18 @@ const TagInput = forwardRef<InputRef, TagInputProps>((originalProps, ref) => {
118118
};
119119

120120
useEffect(() => {
121-
if (!isBreakLine || !suffix) return;
122-
123-
// 避免 suffix 左侧 与 tag 重合
124-
updateSuffixWidth(
125-
`.${prefix}-input__suffix:not(.${prefix}-input__suffix-icon)`,
126-
`--${prefix}-tag-input-suffix-width`,
127-
suffixWidthRef,
128-
);
121+
if (!isBreakLine) return;
122+
123+
if (suffix) {
124+
// 避免 suffix 左侧 与 tag 重合
125+
updateSuffixWidth(
126+
`.${prefix}-input__suffix:not(.${prefix}-input__suffix-icon)`,
127+
`--${prefix}-tag-input-suffix-width`,
128+
suffixWidthRef,
129+
);
130+
}
129131

130-
// 确定 suffix 右侧到 input 边框的距离
132+
// 确定 suffixIcon 右侧到 input 边框的距离
131133
updateSuffixWidth(`.${prefix}-input__suffix-icon`, `--${prefix}-tag-input-suffix-icon-width`, suffixIconWidthRef);
132134

133135
// eslint-disable-next-line react-hooks/exhaustive-deps

0 commit comments

Comments
 (0)