You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The runtime contains a type check to determine if a user-provided ref is
a valid type — a function or object (or a string, when
`disableStringRefs` is off). This currently happens during child
reconciliation. This changes it to happen only when the ref is passed to
the component that the ref is being attached to.
This is a continuation of the "ref as prop" change — until you actually
pass a ref to a HostComponent, class, etc, ref is a normal prop that has
no special behavior.
DiffTrain build for commit 2f8f776.
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js
"Expected ref to be a function, a string, an object returned by React.createRef(), or null."
1472
-
);
1469
+
if(!returnFiber)
1473
1470
throwError(
1474
1471
"Element ref was specified as a string ("+
1475
-
mixedRef+
1472
+
stringRef+
1476
1473
") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://reactjs.org/link/refs-must-have-owner for more information."
1477
1474
);
1478
-
}
1479
1475
if(1!==returnFiber.tag)
1480
1476
throwError(
1481
1477
"Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref"
1482
1478
);
1483
-
varstringRef=""+mixedRef,
1484
-
inst=returnFiber.stateNode;
1479
+
varinst=returnFiber.stateNode;
1485
1480
if(!inst)
1486
1481
throwError(
1487
1482
"Missing owner for string ref "+
@@ -1501,9 +1496,9 @@ function convertStringRefToCallbackRef(
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js
"Expected ref to be a function, a string, an object returned by React.createRef(), or null."
1492
-
);
1489
+
if(!returnFiber)
1493
1490
throwError(
1494
1491
"Element ref was specified as a string ("+
1495
-
mixedRef+
1492
+
stringRef+
1496
1493
") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://reactjs.org/link/refs-must-have-owner for more information."
1497
1494
);
1498
-
}
1499
1495
if(1!==returnFiber.tag)
1500
1496
throwError(
1501
1497
"Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref"
1502
1498
);
1503
-
varstringRef=""+mixedRef,
1504
-
inst=returnFiber.stateNode;
1499
+
varinst=returnFiber.stateNode;
1505
1500
if(!inst)
1506
1501
throwError(
1507
1502
"Missing owner for string ref "+
@@ -1521,9 +1516,9 @@ function convertStringRefToCallbackRef(
0 commit comments