Skip to content

Commit bb30810

Browse files
jin19980928WB01676250
andauthored
feat: TextArea component style only accepts the resize parameter (#296)
* feat:textareaStyle * feat:textareaStyle * feat:textareaStyle * feat:textareaStyle * feat:textareaStyle * feat:textareaStyle * feat:textareaStyle * feat:textareaStyle * feat:textareaStyle --------- Co-authored-by: WB01676250 <jl01676250@antgroup.com>
1 parent eac9183 commit bb30810

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/Mentions.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,13 @@ const InternalMentions = forwardRef<MentionsRef, MentionsProps>(
475475
>
476476
<TextArea
477477
classNames={{ textarea: mentionClassNames?.textarea }}
478+
/**
479+
* Example:<Mentions style={{ resize: 'none' }} />.
480+
* If written this way, resizing here will become invalid.
481+
* The TextArea component code and found that the resize parameter in the style of the ResizeTextArea component is obtained from prop.style.
482+
* Just pass the resize attribute and leave everything else unchanged.
483+
*/
484+
style={{ resize: style?.resize }}
478485
styles={{ textarea: styles?.textarea }}
479486
ref={textareaRef}
480487
value={mergedValue}

tests/Mentions.spec.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,5 +355,19 @@ describe('Mentions', () => {
355355
container.querySelector('.rc-mentions-affix-wrapper'),
356356
);
357357
});
358+
359+
it('should apply resize style to textarea', () => {
360+
const { container } = render(
361+
<Mentions style={{ resize: 'none' }}>
362+
<Option value="bamboo">Bamboo</Option>
363+
<Option value="light">Light</Option>
364+
<Option value="cat">Cat</Option>
365+
</Mentions>,
366+
);
367+
368+
const textarea = container.querySelector('textarea');
369+
expect(textarea).not.toBeNull();
370+
expect(textarea?.style.resize).toBe('none');
371+
});
358372
});
359373
});

0 commit comments

Comments
 (0)