diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index 1c9565dce00a0..8ea55383a0261 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<1d3d484449a45d9d48c574d191f78a9b>> + * @generated SignedSource<> */ "use strict"; @@ -5039,127 +5039,138 @@ if (__DEV__) { return trackUsedThenable(thenableState$1, thenable, index); } - function coerceRef(returnFiber, current, element) { - var mixedRef; - - { - // Old behavior. - mixedRef = element.ref; - } - - if ( - mixedRef !== null && - typeof mixedRef !== "function" && - typeof mixedRef !== "object" - ) { - { - if ( - // Will already throw with "Function components cannot have string refs" - !(element._owner && element._owner.tag !== ClassComponent) && // Will already warn with "Function components cannot be given refs" - !( - typeof element.type === "function" && !isReactClass(element.type) - ) && // Will already throw with "Element ref was specified as a string (someStringRef) but no owner was set" - element._owner - ) { - var componentName = - getComponentNameFromFiber(returnFiber) || "Component"; - - if (!didWarnAboutStringRefs[componentName]) { - error( - 'Component "%s" contains the string ref "%s". Support for string refs ' + - "will be removed in a future major release. We recommend using " + - "useRef() or createRef() instead. " + - "Learn more about using refs safely here: " + - "https://reactjs.org/link/strict-mode-string-ref", - componentName, - mixedRef - ); + function convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef + ) { + var owner = element._owner; - didWarnAboutStringRefs[componentName] = true; - } - } + if (!owner) { + if (typeof mixedRef !== "string") { + throw new Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ); } - if (element._owner) { - var owner = element._owner; - var inst; + throw new Error( + "Element ref was specified as a string (" + + mixedRef + + ") but no owner was set. This could happen for one of" + + " the following reasons:\n" + + "1. You may be adding a ref to a function component\n" + + "2. You may be adding a ref to a component that was not created inside a component's render method\n" + + "3. You have multiple copies of React loaded\n" + + "See https://reactjs.org/link/refs-must-have-owner for more information." + ); + } - if (owner) { - var ownerFiber = owner; + if (owner.tag !== ClassComponent) { + throw new Error( + "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" + ); + } // At this point, we know the ref isn't an object or function but it could + // be a number. Coerce it to a string. - if (ownerFiber.tag !== ClassComponent) { - throw new Error( - "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" - ); - } + { + checkPropStringCoercion(mixedRef, "ref"); + } - inst = ownerFiber.stateNode; - } + var stringRef = "" + mixedRef; - if (!inst) { - throw new Error( - "Missing owner for string ref " + - mixedRef + - ". This error is likely caused by a " + - "bug in React. Please file an issue." - ); - } // Assigning this to a const so Flow knows it won't change in the closure + { + if ( + // Will already warn with "Function components cannot be given refs" + !(typeof element.type === "function" && !isReactClass(element.type)) + ) { + var componentName = + getComponentNameFromFiber(returnFiber) || "Component"; - var resolvedInst = inst; + if (!didWarnAboutStringRefs[componentName]) { + error( + 'Component "%s" contains the string ref "%s". Support for string refs ' + + "will be removed in a future major release. We recommend using " + + "useRef() or createRef() instead. " + + "Learn more about using refs safely here: " + + "https://reactjs.org/link/strict-mode-string-ref", + componentName, + stringRef + ); - { - checkPropStringCoercion(mixedRef, "ref"); + didWarnAboutStringRefs[componentName] = true; } + } + } - var stringRef = "" + mixedRef; // Check if previous string ref matches new string ref + var inst = owner.stateNode; - if ( - current !== null && - current.ref !== null && - typeof current.ref === "function" && - current.ref._stringRef === stringRef - ) { - return current.ref; - } + if (!inst) { + throw new Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a " + + "bug in React. Please file an issue." + ); + } // Check if previous string ref matches new string ref - var ref = function (value) { - var refs = resolvedInst.refs; + if ( + current !== null && + current.ref !== null && + typeof current.ref === "function" && + current.ref._stringRef === stringRef + ) { + // Reuse the existing string ref + var currentRef = current.ref; + return currentRef; + } // Create a new string ref - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; + var ref = function (value) { + var refs = inst.refs; - ref._stringRef = stringRef; - return ref; + if (value === null) { + delete refs[stringRef]; } else { - if (typeof mixedRef !== "string") { - throw new Error( - "Expected ref to be a function, a string, an object returned by React.createRef(), or null." - ); - } - - if (!element._owner) { - throw new Error( - "Element ref was specified as a string (" + - mixedRef + - ") but no owner was set. This could happen for one of" + - " the following reasons:\n" + - "1. You may be adding a ref to a function component\n" + - "2. You may be adding a ref to a component that was not created inside a component's render method\n" + - "3. You have multiple copies of React loaded\n" + - "See https://reactjs.org/link/refs-must-have-owner for more information." - ); - } + refs[stringRef] = value; } + }; + + ref._stringRef = stringRef; + return ref; + } + + function coerceRef(returnFiber, current, workInProgress, element) { + var mixedRef; + + { + // Old behavior. + mixedRef = element.ref; } - return mixedRef; + var coercedRef; + + if ( + mixedRef !== null && + typeof mixedRef !== "function" && + typeof mixedRef !== "object" + ) { + // Assume this is a string ref. If it's not, then this will throw an error + // to the user. + coercedRef = convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef + ); + } else { + coercedRef = mixedRef; + } // TODO: If enableRefAsProp is on, we shouldn't use the `ref` field. We + // should always read the ref from the prop. + + workInProgress.ref = coercedRef; } function throwOnInvalidObjectType(returnFiber, newChild) { @@ -5415,7 +5426,7 @@ if (__DEV__) { ) { // Move based on index var existing = useFiber(current, element.props); - existing.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, existing, element); existing.return = returnFiber; { @@ -5428,7 +5439,7 @@ if (__DEV__) { } // Insert var created = createFiberFromElement(element, returnFiber.mode, lanes); - created.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, created, element); created.return = returnFiber; { @@ -5534,7 +5545,7 @@ if (__DEV__) { lanes ); - _created.ref = coerceRef(returnFiber, null, newChild); + coerceRef(returnFiber, null, _created, newChild); _created.return = returnFiber; { @@ -6397,7 +6408,7 @@ if (__DEV__) { var _existing = useFiber(child, element.props); - _existing.ref = coerceRef(returnFiber, child, element); + coerceRef(returnFiber, child, _existing, element); _existing.return = returnFiber; { @@ -6439,7 +6450,7 @@ if (__DEV__) { lanes ); - _created4.ref = coerceRef(returnFiber, currentFirstChild, element); + coerceRef(returnFiber, currentFirstChild, _created4, element); _created4.return = returnFiber; { @@ -25696,7 +25707,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-canary-ddd736d25-20240221"; + var ReactVersion = "18.3.0-canary-dc30644ca-20240221"; // Might add PROFILE later. diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js index 23a09334717b3..c2cbcc8338d82 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<5572049a3941ae58bad5a378320ee208>> + * @generated SignedSource<<74c9b737997575eb03bf09dfe096e458>> */ "use strict"; @@ -1454,56 +1454,59 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function coerceRef(returnFiber, current, element) { - returnFiber = element.ref; - if ( - null !== returnFiber && - "function" !== typeof returnFiber && - "object" !== typeof returnFiber - ) { - if (element._owner) { - element = element._owner; - if (element) { - if (1 !== element.tag) - throw Error( - "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" - ); - var inst = element.stateNode; - } - if (!inst) - throw Error( - "Missing owner for string ref " + - returnFiber + - ". This error is likely caused by a bug in React. Please file an issue." - ); - var resolvedInst = inst, - stringRef = "" + returnFiber; - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - current = function (value) { - var refs = resolvedInst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - }; - current._stringRef = stringRef; - return current; - } - if ("string" !== typeof returnFiber) +function convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef +) { + function ref(value) { + var refs = inst.refs; + null === value ? delete refs[stringRef] : (refs[stringRef] = value); + } + returnFiber = element._owner; + if (!returnFiber) { + if ("string" !== typeof mixedRef) throw Error( "Expected ref to be a function, a string, an object returned by React.createRef(), or null." ); - if (!element._owner) - throw Error( - "Element ref was specified as a string (" + - returnFiber + - ") 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." - ); + throw Error( + "Element ref was specified as a string (" + + mixedRef + + ") 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." + ); } - return returnFiber; + if (1 !== returnFiber.tag) + throw Error( + "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" + ); + var stringRef = "" + mixedRef, + inst = returnFiber.stateNode; + if (!inst) + throw Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a bug in React. Please file an issue." + ); + if ( + null !== current && + null !== current.ref && + "function" === typeof current.ref && + current.ref._stringRef === stringRef + ) + return current.ref; + ref._stringRef = stringRef; + return ref; +} +function coerceRef(returnFiber, current, workInProgress, element) { + var mixedRef = element.ref; + returnFiber = + null !== mixedRef && + "function" !== typeof mixedRef && + "object" !== typeof mixedRef + ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) + : mixedRef; + workInProgress.ref = returnFiber; } function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); @@ -1601,7 +1604,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) return ( (lanes = useFiber(current, element.props)), - (lanes.ref = coerceRef(returnFiber, current, element)), + coerceRef(returnFiber, current, lanes, element), (lanes.return = returnFiber), lanes ); @@ -1613,7 +1616,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - lanes.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, lanes, element); lanes.return = returnFiber; return lanes; } @@ -1675,7 +1678,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef(returnFiber, null, newChild)), + coerceRef(returnFiber, null, lanes, newChild), (lanes.return = returnFiber), lanes ); @@ -2040,11 +2043,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) { deleteRemainingChildren(returnFiber, child.sibling); currentFirstChild = useFiber(child, newChild.props); - currentFirstChild.ref = coerceRef( - returnFiber, - child, - newChild - ); + coerceRef(returnFiber, child, currentFirstChild, newChild); currentFirstChild.return = returnFiber; returnFiber = currentFirstChild; break a; @@ -2071,11 +2070,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef( - returnFiber, - currentFirstChild, - newChild - )), + coerceRef(returnFiber, currentFirstChild, lanes, newChild), (lanes.return = returnFiber), (returnFiber = lanes)); } @@ -9176,7 +9171,7 @@ var devToolsConfig$jscomp$inline_1014 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-ddd736d25-20240221", + version: "18.3.0-canary-dc30644ca-20240221", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1195 = { @@ -9207,7 +9202,7 @@ var internals$jscomp$inline_1195 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-ddd736d25-20240221" + reconcilerVersion: "18.3.0-canary-dc30644ca-20240221" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1196 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js index 62292789485f6..cf67f855aa6a0 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<86e7f77200b19412957b194553a75177>> */ "use strict"; @@ -1474,56 +1474,59 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function coerceRef(returnFiber, current, element) { - returnFiber = element.ref; - if ( - null !== returnFiber && - "function" !== typeof returnFiber && - "object" !== typeof returnFiber - ) { - if (element._owner) { - element = element._owner; - if (element) { - if (1 !== element.tag) - throw Error( - "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" - ); - var inst = element.stateNode; - } - if (!inst) - throw Error( - "Missing owner for string ref " + - returnFiber + - ". This error is likely caused by a bug in React. Please file an issue." - ); - var resolvedInst = inst, - stringRef = "" + returnFiber; - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - current = function (value) { - var refs = resolvedInst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - }; - current._stringRef = stringRef; - return current; - } - if ("string" !== typeof returnFiber) +function convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef +) { + function ref(value) { + var refs = inst.refs; + null === value ? delete refs[stringRef] : (refs[stringRef] = value); + } + returnFiber = element._owner; + if (!returnFiber) { + if ("string" !== typeof mixedRef) throw Error( "Expected ref to be a function, a string, an object returned by React.createRef(), or null." ); - if (!element._owner) - throw Error( - "Element ref was specified as a string (" + - returnFiber + - ") 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." - ); + throw Error( + "Element ref was specified as a string (" + + mixedRef + + ") 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." + ); } - return returnFiber; + if (1 !== returnFiber.tag) + throw Error( + "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" + ); + var stringRef = "" + mixedRef, + inst = returnFiber.stateNode; + if (!inst) + throw Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a bug in React. Please file an issue." + ); + if ( + null !== current && + null !== current.ref && + "function" === typeof current.ref && + current.ref._stringRef === stringRef + ) + return current.ref; + ref._stringRef = stringRef; + return ref; +} +function coerceRef(returnFiber, current, workInProgress, element) { + var mixedRef = element.ref; + returnFiber = + null !== mixedRef && + "function" !== typeof mixedRef && + "object" !== typeof mixedRef + ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) + : mixedRef; + workInProgress.ref = returnFiber; } function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); @@ -1621,7 +1624,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) return ( (lanes = useFiber(current, element.props)), - (lanes.ref = coerceRef(returnFiber, current, element)), + coerceRef(returnFiber, current, lanes, element), (lanes.return = returnFiber), lanes ); @@ -1633,7 +1636,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - lanes.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, lanes, element); lanes.return = returnFiber; return lanes; } @@ -1695,7 +1698,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef(returnFiber, null, newChild)), + coerceRef(returnFiber, null, lanes, newChild), (lanes.return = returnFiber), lanes ); @@ -2060,11 +2063,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) { deleteRemainingChildren(returnFiber, child.sibling); currentFirstChild = useFiber(child, newChild.props); - currentFirstChild.ref = coerceRef( - returnFiber, - child, - newChild - ); + coerceRef(returnFiber, child, currentFirstChild, newChild); currentFirstChild.return = returnFiber; returnFiber = currentFirstChild; break a; @@ -2091,11 +2090,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef( - returnFiber, - currentFirstChild, - newChild - )), + coerceRef(returnFiber, currentFirstChild, lanes, newChild), (lanes.return = returnFiber), (returnFiber = lanes)); } @@ -9604,7 +9599,7 @@ var devToolsConfig$jscomp$inline_1056 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-ddd736d25-20240221", + version: "18.3.0-canary-dc30644ca-20240221", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1236 = { @@ -9635,7 +9630,7 @@ var internals$jscomp$inline_1236 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-ddd736d25-20240221" + reconcilerVersion: "18.3.0-canary-dc30644ca-20240221" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1237 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js index 235ebbd3fabf7..6fde1abde455c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js @@ -24,7 +24,7 @@ if (__DEV__) { ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } - var ReactVersion = "18.3.0-canary-ddd736d25-20240221"; + var ReactVersion = "18.3.0-canary-dc30644ca-20240221"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js index 227956a434de6..0dfbe66ff4bb1 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js @@ -600,4 +600,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-ddd736d25-20240221"; +exports.version = "18.3.0-canary-dc30644ca-20240221"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js index 02d7c71750c23..42e143df045be 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js @@ -596,7 +596,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-ddd736d25-20240221"; +exports.version = "18.3.0-canary-dc30644ca-20240221"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index 2d5c6aad52da5..ffc3a20dbd56e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -ddd736d2589c972e1ac75402f2e2e833e97ad61a +dc30644ca77e52a2760e81fbdbcfbd2f2fd4979c diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 58a3603c7b247..3c05dae9dda4b 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<383f07630be8104f7153897f592f9079>> + * @generated SignedSource<> */ "use strict"; @@ -8678,127 +8678,138 @@ to return true:wantsResponderID| | return trackUsedThenable(thenableState$1, thenable, index); } - function coerceRef(returnFiber, current, element) { - var mixedRef; - - { - // Old behavior. - mixedRef = element.ref; - } - - if ( - mixedRef !== null && - typeof mixedRef !== "function" && - typeof mixedRef !== "object" - ) { - { - if ( - // Will already throw with "Function components cannot have string refs" - !(element._owner && element._owner.tag !== ClassComponent) && // Will already warn with "Function components cannot be given refs" - !( - typeof element.type === "function" && !isReactClass(element.type) - ) && // Will already throw with "Element ref was specified as a string (someStringRef) but no owner was set" - element._owner - ) { - var componentName = - getComponentNameFromFiber(returnFiber) || "Component"; - - if (!didWarnAboutStringRefs[componentName]) { - error( - 'Component "%s" contains the string ref "%s". Support for string refs ' + - "will be removed in a future major release. We recommend using " + - "useRef() or createRef() instead. " + - "Learn more about using refs safely here: " + - "https://reactjs.org/link/strict-mode-string-ref", - componentName, - mixedRef - ); + function convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef + ) { + var owner = element._owner; - didWarnAboutStringRefs[componentName] = true; - } - } + if (!owner) { + if (typeof mixedRef !== "string") { + throw new Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ); } - if (element._owner) { - var owner = element._owner; - var inst; + throw new Error( + "Element ref was specified as a string (" + + mixedRef + + ") but no owner was set. This could happen for one of" + + " the following reasons:\n" + + "1. You may be adding a ref to a function component\n" + + "2. You may be adding a ref to a component that was not created inside a component's render method\n" + + "3. You have multiple copies of React loaded\n" + + "See https://reactjs.org/link/refs-must-have-owner for more information." + ); + } - if (owner) { - var ownerFiber = owner; + if (owner.tag !== ClassComponent) { + throw new Error( + "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" + ); + } // At this point, we know the ref isn't an object or function but it could + // be a number. Coerce it to a string. - if (ownerFiber.tag !== ClassComponent) { - throw new Error( - "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" - ); - } + { + checkPropStringCoercion(mixedRef, "ref"); + } - inst = ownerFiber.stateNode; - } + var stringRef = "" + mixedRef; - if (!inst) { - throw new Error( - "Missing owner for string ref " + - mixedRef + - ". This error is likely caused by a " + - "bug in React. Please file an issue." - ); - } // Assigning this to a const so Flow knows it won't change in the closure + { + if ( + // Will already warn with "Function components cannot be given refs" + !(typeof element.type === "function" && !isReactClass(element.type)) + ) { + var componentName = + getComponentNameFromFiber(returnFiber) || "Component"; - var resolvedInst = inst; + if (!didWarnAboutStringRefs[componentName]) { + error( + 'Component "%s" contains the string ref "%s". Support for string refs ' + + "will be removed in a future major release. We recommend using " + + "useRef() or createRef() instead. " + + "Learn more about using refs safely here: " + + "https://reactjs.org/link/strict-mode-string-ref", + componentName, + stringRef + ); - { - checkPropStringCoercion(mixedRef, "ref"); + didWarnAboutStringRefs[componentName] = true; } + } + } - var stringRef = "" + mixedRef; // Check if previous string ref matches new string ref + var inst = owner.stateNode; - if ( - current !== null && - current.ref !== null && - typeof current.ref === "function" && - current.ref._stringRef === stringRef - ) { - return current.ref; - } + if (!inst) { + throw new Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a " + + "bug in React. Please file an issue." + ); + } // Check if previous string ref matches new string ref - var ref = function (value) { - var refs = resolvedInst.refs; + if ( + current !== null && + current.ref !== null && + typeof current.ref === "function" && + current.ref._stringRef === stringRef + ) { + // Reuse the existing string ref + var currentRef = current.ref; + return currentRef; + } // Create a new string ref - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; + var ref = function (value) { + var refs = inst.refs; - ref._stringRef = stringRef; - return ref; + if (value === null) { + delete refs[stringRef]; } else { - if (typeof mixedRef !== "string") { - throw new Error( - "Expected ref to be a function, a string, an object returned by React.createRef(), or null." - ); - } - - if (!element._owner) { - throw new Error( - "Element ref was specified as a string (" + - mixedRef + - ") but no owner was set. This could happen for one of" + - " the following reasons:\n" + - "1. You may be adding a ref to a function component\n" + - "2. You may be adding a ref to a component that was not created inside a component's render method\n" + - "3. You have multiple copies of React loaded\n" + - "See https://reactjs.org/link/refs-must-have-owner for more information." - ); - } + refs[stringRef] = value; } + }; + + ref._stringRef = stringRef; + return ref; + } + + function coerceRef(returnFiber, current, workInProgress, element) { + var mixedRef; + + { + // Old behavior. + mixedRef = element.ref; } - return mixedRef; + var coercedRef; + + if ( + mixedRef !== null && + typeof mixedRef !== "function" && + typeof mixedRef !== "object" + ) { + // Assume this is a string ref. If it's not, then this will throw an error + // to the user. + coercedRef = convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef + ); + } else { + coercedRef = mixedRef; + } // TODO: If enableRefAsProp is on, we shouldn't use the `ref` field. We + // should always read the ref from the prop. + + workInProgress.ref = coercedRef; } function throwOnInvalidObjectType(returnFiber, newChild) { @@ -9054,7 +9065,7 @@ to return true:wantsResponderID| | ) { // Move based on index var existing = useFiber(current, element.props); - existing.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, existing, element); existing.return = returnFiber; { @@ -9067,7 +9078,7 @@ to return true:wantsResponderID| | } // Insert var created = createFiberFromElement(element, returnFiber.mode, lanes); - created.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, created, element); created.return = returnFiber; { @@ -9173,7 +9184,7 @@ to return true:wantsResponderID| | lanes ); - _created.ref = coerceRef(returnFiber, null, newChild); + coerceRef(returnFiber, null, _created, newChild); _created.return = returnFiber; { @@ -10036,7 +10047,7 @@ to return true:wantsResponderID| | var _existing = useFiber(child, element.props); - _existing.ref = coerceRef(returnFiber, child, element); + coerceRef(returnFiber, child, _existing, element); _existing.return = returnFiber; { @@ -10078,7 +10089,7 @@ to return true:wantsResponderID| | lanes ); - _created4.ref = coerceRef(returnFiber, currentFirstChild, element); + coerceRef(returnFiber, currentFirstChild, _created4, element); _created4.return = returnFiber; { @@ -27735,7 +27746,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "18.3.0-canary-232f2dc2"; + var ReactVersion = "18.3.0-canary-11955a0b"; function createPortal$1( children, diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index 1f8152927dd4d..ea8109dfe0ed0 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<752d9bfb239e2381d7f48dd5633002ac>> */ "use strict"; @@ -2737,56 +2737,59 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function coerceRef(returnFiber, current, element) { - returnFiber = element.ref; - if ( - null !== returnFiber && - "function" !== typeof returnFiber && - "object" !== typeof returnFiber - ) { - if (element._owner) { - element = element._owner; - if (element) { - if (1 !== element.tag) - throw Error( - "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" - ); - var inst = element.stateNode; - } - if (!inst) - throw Error( - "Missing owner for string ref " + - returnFiber + - ". This error is likely caused by a bug in React. Please file an issue." - ); - var resolvedInst = inst, - stringRef = "" + returnFiber; - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - current = function (value) { - var refs = resolvedInst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - }; - current._stringRef = stringRef; - return current; - } - if ("string" !== typeof returnFiber) +function convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef +) { + function ref(value) { + var refs = inst.refs; + null === value ? delete refs[stringRef] : (refs[stringRef] = value); + } + returnFiber = element._owner; + if (!returnFiber) { + if ("string" !== typeof mixedRef) throw Error( "Expected ref to be a function, a string, an object returned by React.createRef(), or null." ); - if (!element._owner) - throw Error( - "Element ref was specified as a string (" + - returnFiber + - ") 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." - ); + throw Error( + "Element ref was specified as a string (" + + mixedRef + + ") 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." + ); } - return returnFiber; + if (1 !== returnFiber.tag) + throw Error( + "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" + ); + var stringRef = "" + mixedRef, + inst = returnFiber.stateNode; + if (!inst) + throw Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a bug in React. Please file an issue." + ); + if ( + null !== current && + null !== current.ref && + "function" === typeof current.ref && + current.ref._stringRef === stringRef + ) + return current.ref; + ref._stringRef = stringRef; + return ref; +} +function coerceRef(returnFiber, current, workInProgress, element) { + var mixedRef = element.ref; + returnFiber = + null !== mixedRef && + "function" !== typeof mixedRef && + "object" !== typeof mixedRef + ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) + : mixedRef; + workInProgress.ref = returnFiber; } function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); @@ -2884,7 +2887,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) return ( (lanes = useFiber(current, element.props)), - (lanes.ref = coerceRef(returnFiber, current, element)), + coerceRef(returnFiber, current, lanes, element), (lanes.return = returnFiber), lanes ); @@ -2896,7 +2899,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - lanes.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, lanes, element); lanes.return = returnFiber; return lanes; } @@ -2958,7 +2961,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef(returnFiber, null, newChild)), + coerceRef(returnFiber, null, lanes, newChild), (lanes.return = returnFiber), lanes ); @@ -3323,11 +3326,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) { deleteRemainingChildren(returnFiber, child.sibling); currentFirstChild = useFiber(child, newChild.props); - currentFirstChild.ref = coerceRef( - returnFiber, - child, - newChild - ); + coerceRef(returnFiber, child, currentFirstChild, newChild); currentFirstChild.return = returnFiber; returnFiber = currentFirstChild; break a; @@ -3354,11 +3353,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef( - returnFiber, - currentFirstChild, - newChild - )), + coerceRef(returnFiber, currentFirstChild, lanes, newChild), (lanes.return = returnFiber), (returnFiber = lanes)); } @@ -9537,7 +9532,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1067 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "18.3.0-canary-04f4e3d5", + version: "18.3.0-canary-9cb0e0fc", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -9580,7 +9575,7 @@ var internals$jscomp$inline_1292 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-04f4e3d5" + reconcilerVersion: "18.3.0-canary-9cb0e0fc" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1293 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index d3bb6c90befb8..f30b805c85338 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<7cbd2fe431f9092a57914cf978a61a94>> + * @generated SignedSource<> */ "use strict"; @@ -2862,56 +2862,59 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function coerceRef(returnFiber, current, element) { - returnFiber = element.ref; - if ( - null !== returnFiber && - "function" !== typeof returnFiber && - "object" !== typeof returnFiber - ) { - if (element._owner) { - element = element._owner; - if (element) { - if (1 !== element.tag) - throw Error( - "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" - ); - var inst = element.stateNode; - } - if (!inst) - throw Error( - "Missing owner for string ref " + - returnFiber + - ". This error is likely caused by a bug in React. Please file an issue." - ); - var resolvedInst = inst, - stringRef = "" + returnFiber; - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - current = function (value) { - var refs = resolvedInst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - }; - current._stringRef = stringRef; - return current; - } - if ("string" !== typeof returnFiber) +function convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef +) { + function ref(value) { + var refs = inst.refs; + null === value ? delete refs[stringRef] : (refs[stringRef] = value); + } + returnFiber = element._owner; + if (!returnFiber) { + if ("string" !== typeof mixedRef) throw Error( "Expected ref to be a function, a string, an object returned by React.createRef(), or null." ); - if (!element._owner) - throw Error( - "Element ref was specified as a string (" + - returnFiber + - ") 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." - ); + throw Error( + "Element ref was specified as a string (" + + mixedRef + + ") 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." + ); } - return returnFiber; + if (1 !== returnFiber.tag) + throw Error( + "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" + ); + var stringRef = "" + mixedRef, + inst = returnFiber.stateNode; + if (!inst) + throw Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a bug in React. Please file an issue." + ); + if ( + null !== current && + null !== current.ref && + "function" === typeof current.ref && + current.ref._stringRef === stringRef + ) + return current.ref; + ref._stringRef = stringRef; + return ref; +} +function coerceRef(returnFiber, current, workInProgress, element) { + var mixedRef = element.ref; + returnFiber = + null !== mixedRef && + "function" !== typeof mixedRef && + "object" !== typeof mixedRef + ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) + : mixedRef; + workInProgress.ref = returnFiber; } function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); @@ -3009,7 +3012,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) return ( (lanes = useFiber(current, element.props)), - (lanes.ref = coerceRef(returnFiber, current, element)), + coerceRef(returnFiber, current, lanes, element), (lanes.return = returnFiber), lanes ); @@ -3021,7 +3024,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - lanes.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, lanes, element); lanes.return = returnFiber; return lanes; } @@ -3083,7 +3086,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef(returnFiber, null, newChild)), + coerceRef(returnFiber, null, lanes, newChild), (lanes.return = returnFiber), lanes ); @@ -3448,11 +3451,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) { deleteRemainingChildren(returnFiber, child.sibling); currentFirstChild = useFiber(child, newChild.props); - currentFirstChild.ref = coerceRef( - returnFiber, - child, - newChild - ); + coerceRef(returnFiber, child, currentFirstChild, newChild); currentFirstChild.return = returnFiber; returnFiber = currentFirstChild; break a; @@ -3479,11 +3478,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef( - returnFiber, - currentFirstChild, - newChild - )), + coerceRef(returnFiber, currentFirstChild, lanes, newChild), (lanes.return = returnFiber), (returnFiber = lanes)); } @@ -10235,7 +10230,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1145 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "18.3.0-canary-30b9b61b", + version: "18.3.0-canary-b4e8e86e", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10291,7 +10286,7 @@ var roots = new Map(), scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-30b9b61b" + reconcilerVersion: "18.3.0-canary-b4e8e86e" }); exports.createPortal = function (children, containerTag) { return createPortal$1( diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index 1874fca3b65f9..d5d965b6d9b49 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<7dd934733eaf5f0f6996f44b50a9a9b4>> + * @generated SignedSource<<49a859441ae580ff7b03b74ef093157c>> */ "use strict"; @@ -8950,127 +8950,138 @@ to return true:wantsResponderID| | return trackUsedThenable(thenableState$1, thenable, index); } - function coerceRef(returnFiber, current, element) { - var mixedRef; - - { - // Old behavior. - mixedRef = element.ref; - } - - if ( - mixedRef !== null && - typeof mixedRef !== "function" && - typeof mixedRef !== "object" - ) { - { - if ( - // Will already throw with "Function components cannot have string refs" - !(element._owner && element._owner.tag !== ClassComponent) && // Will already warn with "Function components cannot be given refs" - !( - typeof element.type === "function" && !isReactClass(element.type) - ) && // Will already throw with "Element ref was specified as a string (someStringRef) but no owner was set" - element._owner - ) { - var componentName = - getComponentNameFromFiber(returnFiber) || "Component"; - - if (!didWarnAboutStringRefs[componentName]) { - error( - 'Component "%s" contains the string ref "%s". Support for string refs ' + - "will be removed in a future major release. We recommend using " + - "useRef() or createRef() instead. " + - "Learn more about using refs safely here: " + - "https://reactjs.org/link/strict-mode-string-ref", - componentName, - mixedRef - ); + function convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef + ) { + var owner = element._owner; - didWarnAboutStringRefs[componentName] = true; - } - } + if (!owner) { + if (typeof mixedRef !== "string") { + throw new Error( + "Expected ref to be a function, a string, an object returned by React.createRef(), or null." + ); } - if (element._owner) { - var owner = element._owner; - var inst; + throw new Error( + "Element ref was specified as a string (" + + mixedRef + + ") but no owner was set. This could happen for one of" + + " the following reasons:\n" + + "1. You may be adding a ref to a function component\n" + + "2. You may be adding a ref to a component that was not created inside a component's render method\n" + + "3. You have multiple copies of React loaded\n" + + "See https://reactjs.org/link/refs-must-have-owner for more information." + ); + } - if (owner) { - var ownerFiber = owner; + if (owner.tag !== ClassComponent) { + throw new Error( + "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" + ); + } // At this point, we know the ref isn't an object or function but it could + // be a number. Coerce it to a string. - if (ownerFiber.tag !== ClassComponent) { - throw new Error( - "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" - ); - } + { + checkPropStringCoercion(mixedRef, "ref"); + } - inst = ownerFiber.stateNode; - } + var stringRef = "" + mixedRef; - if (!inst) { - throw new Error( - "Missing owner for string ref " + - mixedRef + - ". This error is likely caused by a " + - "bug in React. Please file an issue." - ); - } // Assigning this to a const so Flow knows it won't change in the closure + { + if ( + // Will already warn with "Function components cannot be given refs" + !(typeof element.type === "function" && !isReactClass(element.type)) + ) { + var componentName = + getComponentNameFromFiber(returnFiber) || "Component"; - var resolvedInst = inst; + if (!didWarnAboutStringRefs[componentName]) { + error( + 'Component "%s" contains the string ref "%s". Support for string refs ' + + "will be removed in a future major release. We recommend using " + + "useRef() or createRef() instead. " + + "Learn more about using refs safely here: " + + "https://reactjs.org/link/strict-mode-string-ref", + componentName, + stringRef + ); - { - checkPropStringCoercion(mixedRef, "ref"); + didWarnAboutStringRefs[componentName] = true; } + } + } - var stringRef = "" + mixedRef; // Check if previous string ref matches new string ref + var inst = owner.stateNode; - if ( - current !== null && - current.ref !== null && - typeof current.ref === "function" && - current.ref._stringRef === stringRef - ) { - return current.ref; - } + if (!inst) { + throw new Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a " + + "bug in React. Please file an issue." + ); + } // Check if previous string ref matches new string ref - var ref = function (value) { - var refs = resolvedInst.refs; + if ( + current !== null && + current.ref !== null && + typeof current.ref === "function" && + current.ref._stringRef === stringRef + ) { + // Reuse the existing string ref + var currentRef = current.ref; + return currentRef; + } // Create a new string ref - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; + var ref = function (value) { + var refs = inst.refs; - ref._stringRef = stringRef; - return ref; + if (value === null) { + delete refs[stringRef]; } else { - if (typeof mixedRef !== "string") { - throw new Error( - "Expected ref to be a function, a string, an object returned by React.createRef(), or null." - ); - } - - if (!element._owner) { - throw new Error( - "Element ref was specified as a string (" + - mixedRef + - ") but no owner was set. This could happen for one of" + - " the following reasons:\n" + - "1. You may be adding a ref to a function component\n" + - "2. You may be adding a ref to a component that was not created inside a component's render method\n" + - "3. You have multiple copies of React loaded\n" + - "See https://reactjs.org/link/refs-must-have-owner for more information." - ); - } + refs[stringRef] = value; } + }; + + ref._stringRef = stringRef; + return ref; + } + + function coerceRef(returnFiber, current, workInProgress, element) { + var mixedRef; + + { + // Old behavior. + mixedRef = element.ref; } - return mixedRef; + var coercedRef; + + if ( + mixedRef !== null && + typeof mixedRef !== "function" && + typeof mixedRef !== "object" + ) { + // Assume this is a string ref. If it's not, then this will throw an error + // to the user. + coercedRef = convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef + ); + } else { + coercedRef = mixedRef; + } // TODO: If enableRefAsProp is on, we shouldn't use the `ref` field. We + // should always read the ref from the prop. + + workInProgress.ref = coercedRef; } function throwOnInvalidObjectType(returnFiber, newChild) { @@ -9326,7 +9337,7 @@ to return true:wantsResponderID| | ) { // Move based on index var existing = useFiber(current, element.props); - existing.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, existing, element); existing.return = returnFiber; { @@ -9339,7 +9350,7 @@ to return true:wantsResponderID| | } // Insert var created = createFiberFromElement(element, returnFiber.mode, lanes); - created.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, created, element); created.return = returnFiber; { @@ -9445,7 +9456,7 @@ to return true:wantsResponderID| | lanes ); - _created.ref = coerceRef(returnFiber, null, newChild); + coerceRef(returnFiber, null, _created, newChild); _created.return = returnFiber; { @@ -10308,7 +10319,7 @@ to return true:wantsResponderID| | var _existing = useFiber(child, element.props); - _existing.ref = coerceRef(returnFiber, child, element); + coerceRef(returnFiber, child, _existing, element); _existing.return = returnFiber; { @@ -10350,7 +10361,7 @@ to return true:wantsResponderID| | lanes ); - _created4.ref = coerceRef(returnFiber, currentFirstChild, element); + coerceRef(returnFiber, currentFirstChild, _created4, element); _created4.return = returnFiber; { @@ -28176,7 +28187,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "18.3.0-canary-7ee8e435"; + var ReactVersion = "18.3.0-canary-f0be8dd4"; function createPortal$1( children, diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index 7beedcfbc54e5..dfd332966024c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<8aeba5c18f5eccba1c57b8e672f286d3>> */ "use strict"; @@ -2802,56 +2802,59 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function coerceRef(returnFiber, current, element) { - returnFiber = element.ref; - if ( - null !== returnFiber && - "function" !== typeof returnFiber && - "object" !== typeof returnFiber - ) { - if (element._owner) { - element = element._owner; - if (element) { - if (1 !== element.tag) - throw Error( - "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" - ); - var inst = element.stateNode; - } - if (!inst) - throw Error( - "Missing owner for string ref " + - returnFiber + - ". This error is likely caused by a bug in React. Please file an issue." - ); - var resolvedInst = inst, - stringRef = "" + returnFiber; - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - current = function (value) { - var refs = resolvedInst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - }; - current._stringRef = stringRef; - return current; - } - if ("string" !== typeof returnFiber) +function convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef +) { + function ref(value) { + var refs = inst.refs; + null === value ? delete refs[stringRef] : (refs[stringRef] = value); + } + returnFiber = element._owner; + if (!returnFiber) { + if ("string" !== typeof mixedRef) throw Error( "Expected ref to be a function, a string, an object returned by React.createRef(), or null." ); - if (!element._owner) - throw Error( - "Element ref was specified as a string (" + - returnFiber + - ") 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." - ); + throw Error( + "Element ref was specified as a string (" + + mixedRef + + ") 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." + ); } - return returnFiber; + if (1 !== returnFiber.tag) + throw Error( + "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" + ); + var stringRef = "" + mixedRef, + inst = returnFiber.stateNode; + if (!inst) + throw Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a bug in React. Please file an issue." + ); + if ( + null !== current && + null !== current.ref && + "function" === typeof current.ref && + current.ref._stringRef === stringRef + ) + return current.ref; + ref._stringRef = stringRef; + return ref; +} +function coerceRef(returnFiber, current, workInProgress, element) { + var mixedRef = element.ref; + returnFiber = + null !== mixedRef && + "function" !== typeof mixedRef && + "object" !== typeof mixedRef + ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) + : mixedRef; + workInProgress.ref = returnFiber; } function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); @@ -2949,7 +2952,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) return ( (lanes = useFiber(current, element.props)), - (lanes.ref = coerceRef(returnFiber, current, element)), + coerceRef(returnFiber, current, lanes, element), (lanes.return = returnFiber), lanes ); @@ -2961,7 +2964,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - lanes.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, lanes, element); lanes.return = returnFiber; return lanes; } @@ -3023,7 +3026,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef(returnFiber, null, newChild)), + coerceRef(returnFiber, null, lanes, newChild), (lanes.return = returnFiber), lanes ); @@ -3388,11 +3391,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) { deleteRemainingChildren(returnFiber, child.sibling); currentFirstChild = useFiber(child, newChild.props); - currentFirstChild.ref = coerceRef( - returnFiber, - child, - newChild - ); + coerceRef(returnFiber, child, currentFirstChild, newChild); currentFirstChild.return = returnFiber; returnFiber = currentFirstChild; break a; @@ -3419,11 +3418,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef( - returnFiber, - currentFirstChild, - newChild - )), + coerceRef(returnFiber, currentFirstChild, lanes, newChild), (lanes.return = returnFiber), (returnFiber = lanes)); } @@ -9755,7 +9750,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1136 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.3.0-canary-26523433", + version: "18.3.0-canary-3970b5ec", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -9798,7 +9793,7 @@ var internals$jscomp$inline_1375 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-26523433" + reconcilerVersion: "18.3.0-canary-3970b5ec" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1376 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index 8866e6c000d14..6d32dd3a2d013 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<46a0584c4fa5b4015f1619cd4c32b2d8>> + * @generated SignedSource<<5daa4952518e9178c7b8c7cbdcb25612>> */ "use strict"; @@ -2926,56 +2926,59 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function coerceRef(returnFiber, current, element) { - returnFiber = element.ref; - if ( - null !== returnFiber && - "function" !== typeof returnFiber && - "object" !== typeof returnFiber - ) { - if (element._owner) { - element = element._owner; - if (element) { - if (1 !== element.tag) - throw Error( - "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" - ); - var inst = element.stateNode; - } - if (!inst) - throw Error( - "Missing owner for string ref " + - returnFiber + - ". This error is likely caused by a bug in React. Please file an issue." - ); - var resolvedInst = inst, - stringRef = "" + returnFiber; - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - current = function (value) { - var refs = resolvedInst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - }; - current._stringRef = stringRef; - return current; - } - if ("string" !== typeof returnFiber) +function convertStringRefToCallbackRef( + returnFiber, + current, + element, + mixedRef +) { + function ref(value) { + var refs = inst.refs; + null === value ? delete refs[stringRef] : (refs[stringRef] = value); + } + returnFiber = element._owner; + if (!returnFiber) { + if ("string" !== typeof mixedRef) throw Error( "Expected ref to be a function, a string, an object returned by React.createRef(), or null." ); - if (!element._owner) - throw Error( - "Element ref was specified as a string (" + - returnFiber + - ") 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." - ); + throw Error( + "Element ref was specified as a string (" + + mixedRef + + ") 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." + ); } - return returnFiber; + if (1 !== returnFiber.tag) + throw Error( + "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" + ); + var stringRef = "" + mixedRef, + inst = returnFiber.stateNode; + if (!inst) + throw Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a bug in React. Please file an issue." + ); + if ( + null !== current && + null !== current.ref && + "function" === typeof current.ref && + current.ref._stringRef === stringRef + ) + return current.ref; + ref._stringRef = stringRef; + return ref; +} +function coerceRef(returnFiber, current, workInProgress, element) { + var mixedRef = element.ref; + returnFiber = + null !== mixedRef && + "function" !== typeof mixedRef && + "object" !== typeof mixedRef + ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) + : mixedRef; + workInProgress.ref = returnFiber; } function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); @@ -3073,7 +3076,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) return ( (lanes = useFiber(current, element.props)), - (lanes.ref = coerceRef(returnFiber, current, element)), + coerceRef(returnFiber, current, lanes, element), (lanes.return = returnFiber), lanes ); @@ -3085,7 +3088,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - lanes.ref = coerceRef(returnFiber, current, element); + coerceRef(returnFiber, current, lanes, element); lanes.return = returnFiber; return lanes; } @@ -3147,7 +3150,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef(returnFiber, null, newChild)), + coerceRef(returnFiber, null, lanes, newChild), (lanes.return = returnFiber), lanes ); @@ -3512,11 +3515,7 @@ function createChildReconciler(shouldTrackSideEffects) { ) { deleteRemainingChildren(returnFiber, child.sibling); currentFirstChild = useFiber(child, newChild.props); - currentFirstChild.ref = coerceRef( - returnFiber, - child, - newChild - ); + coerceRef(returnFiber, child, currentFirstChild, newChild); currentFirstChild.return = returnFiber; returnFiber = currentFirstChild; break a; @@ -3543,11 +3542,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - (lanes.ref = coerceRef( - returnFiber, - currentFirstChild, - newChild - )), + coerceRef(returnFiber, currentFirstChild, lanes, newChild), (lanes.return = returnFiber), (returnFiber = lanes)); } @@ -10453,7 +10448,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1214 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.3.0-canary-8b1db4d3", + version: "18.3.0-canary-70025dca", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10509,7 +10504,7 @@ var roots = new Map(), scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-8b1db4d3" + reconcilerVersion: "18.3.0-canary-70025dca" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { computeComponentStackForErrorReporting: function (reactTag) {