-
Notifications
You must be signed in to change notification settings - Fork 2.5k
React 19 compatible #6860
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
React 19 compatible #6860
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6860 +/- ##
==========================================
+ Coverage 92.71% 92.75% +0.03%
==========================================
Files 335 336 +1
Lines 7236 7214 -22
Branches 1818 1799 -19
==========================================
- Hits 6709 6691 -18
+ Misses 491 487 -4
Partials 36 36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR adds React 19 compatibility by introducing a low-level registration method (unstableSetRender) to allow developers to override the default ReactDOM render function. Key changes include:
- Creating a new unstable-render utility that defines and exposes unstableSetRender and getReactRender.
- Modifying render-to-body to leverage the new unstableGetReactRender API.
- Updating documentation and menus to reflect the React 19 compatibility approach.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/utils/unstable-render.tsx | New utility offering a hook to override the render |
src/utils/render.ts | Simplified to re-export rendering utilities |
src/utils/render-to-body.ts | Updated to use the new unstable render function |
src/index.ts | Exposes unstableSetRender for external usage |
docs/guide/v5-for-19.{zh,en}.md | Added documentation for React 19 compatibility |
config/menus.tsx | Updated menu entries for the new React 19 guide |
Comments suppressed due to low confidence (1)
src/utils/unstable-render.tsx:18
- The warning condition and message may be misleading: it currently warns based on React major version and the existence of 'createRoot'. For React 19, the check should ensure that createRoot is available; consider revising the condition and message to clearly indicate that the override is intended only when using React 19 without createRoot.
warningOnce(majorVersion < 19 || fullKeys.includes('createRoot'), `[Compatible] antd-mobile v5 support React is 16 ~ 18. see https://github.com/ant-design/ant-design-mobile/pull/6860 for compatible.`)
什么时候发 |
1 similar comment
什么时候发 |
什么时候会发布能兼容react 19的版本 |
when this pr release? |
It seems there is no recent release plan, and I have added a trial plan. Refer to PR #6872 npm i https://pkg.pr.new/ant-design/ant-design-mobile/antd-mobile@6872 |
thank you @Wxh16144 , i think ant design mobile need to update the react spring |
When should I expect the 5.39.1 release? |
Motivation
React 19 has been released for a while. There is no plan for a major upgrade at the moment, but some feedback has been received. It's time to perform patch hack code :).
Solution
Like antd v5, it provides the
unstableSetRender
method, allowing developers to modify ReactDOM rendering method.read more: https://ant.design/docs/react/v5-for-19#unstablesetrender
Monkey patch
Important
Monkey patch, only applicable to the version range
antd-mobile@^5.39.1
;Related Issues