Fix deprecated findDOMNode usage in React 19#909
Fix deprecated findDOMNode usage in React 19#909jtwite wants to merge 5 commits intonaver:masterfrom
Conversation
Update the library to remove the use of deprecated `findDOMNode` and replace it with a ref-based approach. * **NonStrictPanel.tsx** - Replace `findDOMNode` with `React.createRef` to access the DOM element. - Update the `nativeElement` getter to return the current ref. - Modify the `render` method to clone the element with the ref. * **ReactElementProvider.ts** - Update the constructor to accept a ref instead of a `StrictPanel` or `NonStrictPanel`. - Update the `element` getter to return the current ref. - Modify the `show` and `hide` methods to use the ref. * **Flicking.tsx** - Remove the `useFindDOMNode` prop and use a ref-based approach. - Update the `_createPanelRefs` method to use `React.createRef`. - Update the `_getPanels` method to use the new ref-based approach. * **ReactRenderer.ts** - Update the `_collectPanels` method to use the new ref-based approach. - Update the `_createPanel` method to use the new ref-based approach. * **package-lock.json** - Update the version to `4.12.0-snapshot`.
* Add `nativeElement` getter to return the current ref * Update `ReactElementProvider.ts` constructor to accept a ref instead of a `StrictPanel` or `NonStrictPanel` * Update `element` getter to return the current ref * Replace `useFindDOMNode` prop with a ref-based approach in `Flicking.tsx` * Update `_createPanelRefs` method to use `React.createRef` * Update `_getPanels` method to use the new ref-based approach * Update `_collectPanels` method in `ReactRenderer.ts` to use the new ref-based approach * Update `_createPanel` method to use the new ref-based approach
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/naver/egjs-flicking" | ||
| "url": "https://github.com/jtwite/egjs-flicking" |
There was a problem hiding this comment.
Hello @jtwite. Thank you for your contribution.
Could you restore package.json and gitignore before merging it into our main branch?
|
Definitely!
…On Tue, Feb 18, 2025 at 12:16 AM malangfox ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In package.json
<#909 (comment)>:
> @@ -47,7 +47,7 @@
},
"repository": {
"type": "git",
- "url": "https://github.com/naver/egjs-flicking"
+ "url": "https://github.com/jtwite/egjs-flicking"
Hello @jtwite <https://github.com/jtwite>. Thank you for your
contribution.
Could you restore package.json and gitignore before merging it into our
main branch?
—
Reply to this email directly, view it on GitHub
<#909 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADHYXVKYA3KSTVHF6BVBJDL2QLF3FAVCNFSM6AAAAABWO7PMHSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDMMBXHE3TEMRQHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
We are still looking into other ways to resolve this issue, so feel free to give us your insight here. |
@malangfox |
|
@InJaEE @jtwite |
|
@jtwite Please update PR to get merged 😊 |
|
|
||
| protected _createPanel(externalComponent: StrictPanel | NonStrictPanel | HTMLDivElement, options: PanelOptions) { | ||
| return this._strategy.createPanel(externalComponent, options); | ||
| return this._strategy.createPanel(externalComponent.nativeElement, options); |
There was a problem hiding this comment.
Can you also branch if externalComponent is HTMLDivElement which does not use nativeElement?
|
Since there were no additional changes, We will apply the changes you left in PR #931. |
Update the library to remove the use of deprecated
findDOMNodeand replace it with a ref-based approach.NonStrictPanel.tsx
findDOMNodewithReact.createRefto access the DOM element.nativeElementgetter to return the current ref.rendermethod to clone the element with the ref.ReactElementProvider.ts
StrictPanelorNonStrictPanel.elementgetter to return the current ref.showandhidemethods to use the ref.Flicking.tsx
useFindDOMNodeprop and use a ref-based approach._createPanelRefsmethod to useReact.createRef._getPanelsmethod to use the new ref-based approach.ReactRenderer.ts
_collectPanelsmethod to use the new ref-based approach._createPanelmethod to use the new ref-based approach.package-lock.json
4.12.0-snapshot.