react-native-web-hooks icon indicating copy to clipboard operation
react-native-web-hooks copied to clipboard

getNode is being phased out

Open jennifer-dickinson opened this issue 2 years ago • 2 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

This resolved a warning about getNode being deprecated in the future.

Screenshot: Screenshot 2023-03-29 at 10 07 57 AM

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-web-hooks/build/createPseudoHook.js b/node_modules/react-native-web-hooks/build/createPseudoHook.js
index 2c544fb..002cda5 100644
--- a/node_modules/react-native-web-hooks/build/createPseudoHook.js
+++ b/node_modules/react-native-web-hooks/build/createPseudoHook.js
@@ -11,7 +11,7 @@ export default function createPseudoHook({ events }) {
         const [isActive, setActive] = React.useState(false);
         React.useEffect(() => {
             const [eventIn, eventOut] = events;
-            const node = getNode(ref);
+            const node = ref.current;
             if (!node) {
                 return;
             }

This issue body was partially generated by patch-package.

jennifer-dickinson avatar Mar 29 '23 17:03 jennifer-dickinson

This also resolves, "Couldn't find node Error: Argument appears to not be a ReactComponent. Keys: current" I was getting after import.

jamielife avatar Jun 29 '23 17:06 jamielife

@EvanBacon Are there no more plans for updates? I would appreciate it if you could include changes like this for React 19.

km-tr avatar Jun 27 '24 14:06 km-tr