Skip to content

Commit

Permalink
Fix "findNodeHandle inside its render()" False Positive Warning
Browse files Browse the repository at this point in the history
  • Loading branch information
yungsters committed May 29, 2024
1 parent a9a0106 commit 84ac565
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function findHostInstance_DEPRECATED<TElementType: ElementType>(
export function findNodeHandle(componentOrHandle: any): ?number {
if (__DEV__) {
const owner = currentOwner;
if (owner !== null && owner.stateNode !== null) {
if (owner !== null && isRendering && owner.stateNode !== null) {
if (!owner.stateNode._warnedAboutRefsInRender) {
console.error(
'%s is accessing findNodeHandle inside its render(). ' +
Expand Down

0 comments on commit 84ac565

Please sign in to comment.