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

feat/support use modal hooks #6739

Closed

Conversation

tylerrrkd
Copy link
Contributor

@tylerrrkd tylerrrkd commented Sep 3, 2024

background: before, the content rendered by Modal.show could not access the context from the same React instance

add PortalProvider to support const { renderModalInPortal } = usePortal

support const { show, confirm, alert, clear } = useModal which could render element imperatively and inherit context from <ConfigProvider /> smoothly

if this PR approved, will support usePopup in the future

Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 98.09524% with 2 lines in your changes missing coverage. Please review.

Project coverage is 92.76%. Comparing base (b805b5a) to head (82cc469).

Files with missing lines Patch % Lines
src/components/portal-provider/portal-provider.tsx 96.22% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6739      +/-   ##
==========================================
+ Coverage   92.68%   92.76%   +0.07%     
==========================================
  Files         334      337       +3     
  Lines        7191     7294     +103     
  Branches     1795     1775      -20     
==========================================
+ Hits         6665     6766     +101     
- Misses        517      519       +2     
  Partials        9        9              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Sep 3, 2024

PR preview has been successfully built and deployed to https://antd-mobile-preview-pr-6739.surge.sh

@tylerrrkd tylerrrkd changed the title Feat/support use modal hooks [WIP]Feat/support use modal hooks Sep 4, 2024
@tylerrrkd tylerrrkd changed the title [WIP]Feat/support use modal hooks [WIP]feat/support use modal hooks Sep 4, 2024
@tylerrrkd tylerrrkd changed the title [WIP]feat/support use modal hooks feat/support use modal hooks Sep 5, 2024
@tylerrrkd
Copy link
Contributor Author

tylerrrkd commented Sep 5, 2024

@zombieJ @afc163 Hi, big old, review pls.

ConfigProvider,
Modal,
Popup,
PortalProvider,
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure PortalProvider is a good concept. Maybe consider the antd PC style of App component:

https://ant.design/components/app

Copy link
Member

Choose a reason for hiding this comment

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

In early version, antd PC provide useModal with holder & caller. But most user dont need that. So get App component for unique useHook register (like the PortalProvider but wish App can do more instead of portal inject only)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, does it mean that if I refer to app. the style will make more sense with ant design, right?

Copy link
Member

Choose a reason for hiding this comment

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

Ye. We can currently only provide App a dom without style but provide unique useXX ability. It maybe more easy to release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it

@tylerrrkd tylerrrkd closed this Sep 12, 2024
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.

2 participants