Skip to content

Conversation

linaaaqi
Copy link

@linaaaqi linaaaqi commented Dec 11, 2021

@linaaaqi
Copy link
Author

should i add a test for the feature? @zombieJ

@afc163
Copy link
Member

afc163 commented Dec 11, 2021

should i add a test for the feature? @zombieJ

Yep

@codecov
Copy link

codecov bot commented Dec 11, 2021

Codecov Report

Merging #13 (66a1bc3) into master (cbad703) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
src/ResizableTextArea.tsx 98.36% <100.00%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbad703...66a1bc3. Read the comment docs.

@linaaaqi
Copy link
Author

done. @afc163

// 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)) {
Copy link
Member

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 }} />

这样写的话,这个比较会永远不相等,最好做一层浅比较。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,之前只考虑了值有变化的情况下就会重新计算高度。如果要下沉一层再做浅比较,是不是需要考虑autoSize 为boolean值的情况?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以用 shallowequal,浅比较 rc 都用的这个

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

搞定

@afc163 afc163 merged commit 5966db5 into react-component:master Dec 14, 2021
@darknessjs
Copy link

什么时候发布...

@crazyair
Copy link

@losgif 麻烦看下上面这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

the autoSize property of Input.TextArea not support dynamic modify (Textarea 的 autoSize 不支持动态修改)
5 participants