[Web] Add findNodeHandle
web version
#6403
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In many places we use
findNodeHandle
function to get native view that is represented by React component. The problem is that usage of this function onweb
leads to warnings (which are shown viaconsole.error
), that this function in deprecated and should not be used.I've already done 3 PRs that remove usage of
findNodeHandle
onweb
, but it keeps reappearing. That's why I've decided to create our version of this function. On native platforms it is just export fromreact-native
. Onweb
it returns component that is passed into the function.Caution
Note that
findNodeHandle
(or to be exact,findDOMNode
) will be removed in next major version of React (i.e. React 19)Test plan
Verifed on our web-example that it uses web version of
findNodeHandle
.Note
In our example app you can still see depracation warning. This is because of
GestureDetector
fromreact-native-gesture-handler
and it has to be fixed in mentioned library.