Skip to content
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

fix(useSize): 修改获取尺寸问题 #2362

Closed
wants to merge 1 commit into from

Conversation

pandaCure
Copy link

@pandaCure pandaCure commented Nov 8, 2023

🤔 This is a ...

  • New feature
  • [] Bug fix
  • Site / documentation update
  • Demo update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

💡 Background and solution

const App = () => {
    const ref = useRef(null);
    const width = useSize(ref);
    // console.log(51) error
    return <div style={{fontSize: '12px'}} ref={ref}>前程似锦.</div>
}

这里应该获取的实际宽度,而不是可见宽度

@CLAassistant
Copy link

CLAassistant commented Nov 8, 2023

CLA assistant check
All committers have signed the CLA.

@pandaCure pandaCure marked this pull request as draft November 8, 2023 13:59
@pandaCure pandaCure marked this pull request as ready for review November 8, 2023 14:00
@liuyib liuyib changed the title fix: 修改获取尺寸问题 fix(useSize): 修改获取尺寸问题 Nov 9, 2023
@liuyib
Copy link
Collaborator

liuyib commented Nov 9, 2023

相关 issue/PR

useSize 存在的问题在上述 issue/PR 的评论区,包含的问题有:“获取精度问题、DOM 尺寸计算规范问题 和 scale 下的尺寸问题”

这个 PR 肯定是 breaking changes 的,先留着,v4 会统一处理哈~

@liuyib liuyib self-requested a review November 9, 2023 02:22
@liuyib liuyib added the v4 label Nov 9, 2023
@crazylxr
Copy link
Collaborator

不能这么改,参考#2482 这个pr

@crazylxr crazylxr closed this Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants