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: 修复useInViewport的rootMargin值无法使用组件state更新 #1984

Merged
merged 5 commits into from Dec 19, 2022

Conversation

captain1023
Copy link
Contributor

fix rootMargin does not update when using setState

[中文版模板 / Chinese template]

🤔 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?)

🔗 Related issue link

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English fix bug #1979
🇨🇳 Chinese fix bug #1979

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

fix rootMargin does not update when using setState
@CLAassistant
Copy link

CLAassistant commented Nov 24, 2022

CLA assistant check
All committers have signed the CLA.

@hchlq
Copy link
Collaborator

hchlq commented Nov 25, 2022

commit 的信息尽量语义化一点~

@miracles1919 miracles1919 linked an issue Nov 25, 2022 that may be closed by this pull request
修复useInViewport的rootMargin值无法使用组件state更新
@captain1023 captain1023 reopened this Nov 28, 2022
@captain1023
Copy link
Contributor Author

commit 的信息尽量语义化一点~

好的好的

useInViewport的rootMargin值无法使用组件state更新
@captain1023 captain1023 changed the title fix: rootMargin fix: 修复useInViewport的rootMargin值无法使用组件state更新 Nov 28, 2022
@li-jia-nan
Copy link
Collaborator

threshold 是不是也可以作为依赖项监听一下?

添加threshold监听
@captain1023
Copy link
Contributor Author

threshold 是不是也可以作为依赖项监听一下?

我觉得大佬说的对😂

@miracles1919
Copy link
Collaborator

test 补一下吧 ~

@captain1023
Copy link
Contributor Author

test 补一下吧 ~

umm 因为这个要用react setState去设置margin,去改变rootMargin验证效果. 所以Test怎么写目前没什么思路. 可以麻烦大佬们提供个思路或者类似的test案例吗 🙏🙏🙏

@crazylxr crazylxr merged commit 75d2998 into alibaba:master Dec 19, 2022
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.

useInViewport的rootMargin值无法使用组件state更新
6 participants