-
Notifications
You must be signed in to change notification settings - Fork 42
feat: re-render with new autoSize property. #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
should i add a test for the feature? @zombieJ |
Yep |
Codecov Report
@@ Coverage Diff @@
## master #13 +/- ##
==========================================
+ Coverage 98.00% 98.02% +0.02%
==========================================
Files 3 3
Lines 150 152 +2
Branches 43 45 +2
==========================================
+ Hits 147 149 +2
Misses 3 3
Continue to review full report at Codecov.
|
done. @afc163 |
src/ResizableTextArea.tsx
Outdated
// Re-render with the new content then recalculate the height as required. | ||
if (prevProps.value !== this.props.value) { | ||
// Re-render with the new content or new autoSize property then recalculate the height as required. | ||
if ((prevProps.value !== this.props.value) || (prevProps.autoSize !== this.props.autoSize)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<TexArea autoSize={{ minRows: 1, maxRows: 6 }} />
这样写的话,这个比较会永远不相等,最好做一层浅比较。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,之前只考虑了值有变化的情况下就会重新计算高度。如果要下沉一层再做浅比较,是不是需要考虑autoSize 为boolean值的情况?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
要。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以用 shallowequal
,浅比较 rc 都用的这个
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
搞定
什么时候发布... |
@losgif 麻烦看下上面这个问题 |
support to issue(ant-design/ant-design#33202)
close ant-design/ant-design#33202