From b9b9675fe17a40be987f0f575309a4891acd60cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Thu, 22 Aug 2019 11:55:37 +0800 Subject: [PATCH] fix: Not shaking with autosize of TextArea (#18401) * fix: Not shaking with autosize of TextArea * fix ract 15 demo * fix demo * add state * handle event * try to fix react 15 test case --- components/input/TextArea.tsx | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 7 +++ components/input/__tests__/index.test.js | 1 + components/input/demo/autosize-textarea.md | 44 ++++++++++++++----- 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/components/input/TextArea.tsx b/components/input/TextArea.tsx index 9b56290186..2fe065f35f 100644 --- a/components/input/TextArea.tsx +++ b/components/input/TextArea.tsx @@ -45,7 +45,7 @@ class TextArea extends React.Component { componentDidUpdate(prevProps: TextAreaProps) { // Re-render with the new content then recalculate the height as required. if (prevProps.value !== this.props.value) { - this.resizeOnNextFrame(); + this.resizeTextarea(); } } diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index bfd0baebab..a75232535e 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -230,6 +230,13 @@ exports[`renders ./components/input/demo/autosize-textarea.md correctly 1`] = ` class="ant-input" placeholder="Autosize height with minimum and maximum number of lines" /> +
+