`findNodeHandle` is deprecated in React StrictMode
Description
When wrapping a React Native app with React.StrictMode, using a Svg component from react-native-svg triggers console warnings/errors due to the use of the deprecated findNodeHandle function.
Expected Behavior
The app should run without any warnings or errors when using React.StrictMode.
react-native-svg should use an alternative approach that avoids findNodeHandle (e.g. by using refs)
Actual Behavior
Console logs show warnings/errors related to findNodeHandle being deprecated.
This might lead to potential issues in future versions of React Native as the function could be removed entirely.
Steps to reproduce
- Wrap a React Native app with
React.StrictMode. - Render a
SvgorShapecomponent fromreact-native-svganywhere in the app. - Observe the console warnings/errors related to
findNodeHandlebeing deprecated.
Snack or a link to a repository
The reproduction repository is private.
SVG version
15.11.1
React Native version
0.73.6
Platforms
iOS, Android
JavaScript runtime
Hermes
Workflow
React Native
Architecture
Paper (Old Architecture)
Build type
Debug app & dev bundle
Device
iOS simulator
Device model
No response
Acknowledgements
Yes
Hey! 👋
The issue doesn't seem to contain a minimal reproduction.
Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?
+1
I have a react native (expo) project for web. When I upgrade expo version to 53 it is broken becouse of this: https://github.com/necolas/react-native-web/blob/0.20.0/packages/react-native-web/src/exports/findNodeHandle/index.js
The findNodeHandle is deprecated on web and this package is use it:
https://github.com/search?q=repo%3Asoftware-mansion%2Freact-native-svg%20findNodeHandle&type=code
Hey, could you provide a proper reproduction of the issue, ideally using snack? The use of findNodeHandle is limited to mobile platforms, so none of the code linked by @dembal1990 should be running on the web.