From aecaccf93666677ac3969f724f609cb20d01f096 Mon Sep 17 00:00:00 2001 From: acdlite Date: Fri, 5 Apr 2024 14:57:51 +0000 Subject: [PATCH] Move string ref coercion to JSX runtime (#28473) Based on: - #28464 --- This moves the entire string ref implementation out Fiber and into the JSX runtime. The string is converted to a callback ref during element creation. This is a subtle change in behavior, because it will have already been converted to a callback ref if you access element.prop.ref or element.ref. But this is only for Meta, because string refs are disabled entirely in open source. And if it leads to an issue in practice, the solution is to switch to a different ref type, which Meta is going to do regardless. DiffTrain build for commit https://github.com/facebook/react/commit/e3ebcd54b98a4f8f5a9f7e63982fa75578b648ed. --- .../cjs/ReactTestRenderer-dev.js | 278 +++++------------ .../cjs/ReactTestRenderer-prod.js | 184 ++++------- .../cjs/ReactTestRenderer-profiling.js | 170 ++++------ .../vendor/react/cjs/JSXDEVRuntime-dev.js | 275 +++++++++++++++- .../vendor/react/cjs/JSXRuntime-dev.js | 275 +++++++++++++++- .../vendor/react/cjs/JSXRuntime-prod.js | 42 ++- .../vendor/react/cjs/JSXRuntime-profiling.js | 42 ++- .../RKJSModules/vendor/react/cjs/React-dev.js | 293 +++++++++++++++++- .../vendor/react/cjs/React-prod.js | 44 ++- .../vendor/react/cjs/React-profiling.js | 44 ++- .../Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 290 +++++------------ .../implementations/ReactFabric-prod.fb.js | 184 ++++------- .../ReactFabric-profiling.fb.js | 170 ++++------ .../ReactNativeRenderer-dev.fb.js | 290 +++++------------ .../ReactNativeRenderer-prod.fb.js | 184 ++++------- .../ReactNativeRenderer-profiling.fb.js | 170 ++++------ 17 files changed, 1563 insertions(+), 1374 deletions(-) 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 4bbe341a4d3e2..bb94ece482582 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<<3151ca79177b1e7b421f14db372bfd97>> + * @generated SignedSource<<98fc293dc2ddd5bd7ffa9ec7eb7ac707>> */ "use strict"; @@ -5656,81 +5656,6 @@ if (__DEV__) { }; } - /* - * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol - * and Temporal.* types. See https://github.com/facebook/react/pull/22064. - * - * The functions in this module will throw an easier-to-understand, - * easier-to-debug exception with a clear errors message message explaining the - * problem. (Instead of a confusing exception thrown inside the implementation - * of the `value` object). - */ - // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - function typeName(value) { - { - // toStringTag is needed for namespaced types like Temporal.Instant - var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; - var type = - (hasToStringTag && value[Symbol.toStringTag]) || - value.constructor.name || - "Object"; // $FlowFixMe[incompatible-return] - - return type; - } - } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - - function willCoercionThrow(value) { - { - try { - testStringCoercion(value); - return false; - } catch (e) { - return true; - } - } - } - - function testStringCoercion(value) { - // If you ended up here by following an exception call stack, here's what's - // happened: you supplied an object or symbol value to React (as a prop, key, - // DOM attribute, CSS property, string ref, etc.) and when React tried to - // coerce it to a string using `'' + value`, an exception was thrown. - // - // The most common types that will cause this exception are `Symbol` instances - // and Temporal objects like `Temporal.Instant`. But any object that has a - // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this - // exception. (Library authors do this to prevent users from using built-in - // numeric operators like `+` or comparison operators like `>=` because custom - // methods are needed to perform accurate arithmetic or comparison.) - // - // To fix the problem, coerce this object or symbol value to a string before - // passing it to React. The most reliable way is usually `String(value)`. - // - // To find which value is throwing, check the browser or debugger console. - // Before this exception was thrown, there should be `console.error` output - // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the - // problem and how that type was used: key, atrribute, input value prop, etc. - // In most cases, this console output also shows the component and its - // ancestor components where the exception happened. - // - // eslint-disable-next-line react-internal/safe-string-coercion - return "" + value; - } - function checkPropStringCoercion(value, propName) { - { - if (willCoercionThrow(value)) { - error( - "The provided `%s` prop is an unsupported type %s." + - " This value must be coerced to a string before using it here.", - propName, - typeName(value) - ); - - return testStringCoercion(value); // throw (to help callers find troubleshooting comments) - } - } - } - var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; function getThenablesFromState(state) { @@ -6010,7 +5935,6 @@ if (__DEV__) { var didWarnAboutMaps; var didWarnAboutGenerators; - var didWarnAboutStringRefs; var ownerHasKeyUseWarning; var ownerHasFunctionTypeWarning; var ownerHasSymbolTypeWarning; @@ -6020,7 +5944,6 @@ if (__DEV__) { { didWarnAboutMaps = false; didWarnAboutGenerators = false; - didWarnAboutStringRefs = {}; /** * Warn if there's no key explicitly set on dynamic arrays of children or * object keys are not valid. This allows us to keep track of children between @@ -6065,10 +5988,6 @@ if (__DEV__) { }; } - function isReactClass(type) { - return type.prototype && type.prototype.isReactComponent; - } - function unwrapThenable(thenable) { var index = thenableIndexCounter$1; thenableIndexCounter$1 += 1; @@ -6080,128 +5999,16 @@ if (__DEV__) { return trackUsedThenable(thenableState$1, thenable, index); } - function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ) { - { - checkPropStringCoercion(mixedRef, "ref"); - } - - var stringRef = "" + mixedRef; - var owner = element._owner; - - if (!owner) { - throw new Error( - "Element ref was specified as a string (" + - stringRef + - ") 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://react.dev/link/refs-must-have-owner for more information." - ); - } - - 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://react.dev/link/strict-mode-string-ref" - ); - } - - { - if ( - // Will already warn with "Function components cannot be given refs" - !(typeof element.type === "function" && !isReactClass(element.type)) - ) { - 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://react.dev/link/strict-mode-string-ref", - componentName, - stringRef - ); - - didWarnAboutStringRefs[componentName] = true; - } - } - } - - var inst = owner.stateNode; - - 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 - - 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 - - var ref = function (value) { - var refs = inst.refs; - - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; - - ref._stringRef = stringRef; - return ref; - } - function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef; + var ref; { // Old behavior. - mixedRef = element.ref; - } - - var coercedRef; - - if ( - typeof mixedRef === "string" || - typeof mixedRef === "number" || - typeof mixedRef === "boolean" - ) { - coercedRef = convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ); - } else { - coercedRef = mixedRef; + ref = element.ref; } // TODO: If enableRefAsProp is on, we shouldn't use the `ref` field. We // should always read the ref from the prop. - workInProgress.ref = coercedRef; + workInProgress.ref = ref; } function throwOnInvalidObjectType(returnFiber, newChild) { @@ -26823,7 +26630,82 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-canary-29bd6113"; + var ReactVersion = "19.0.0-canary-fbd6543d"; + + /* + * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ + // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; + var type = + (hasToStringTag && value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; // $FlowFixMe[incompatible-return] + + return type; + } + } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + + function willCoercionThrow(value) { + { + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } + } + + function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + return "" + value; + } + function checkPropStringCoercion(value, propName) { + { + if (willCoercionThrow(value)) { + error( + "The provided `%s` prop is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + propName, + typeName(value) + ); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } // 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 dd824d4f4d867..62538650af2a8 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<<432e9d2dc4a6b45da0162dd89f63ecfc>> + * @generated SignedSource<<06b7bf08ce800f028055b90ac4c262ac>> */ "use strict"; @@ -1388,55 +1388,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") 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://react.dev/link/refs-must-have-owner for more information." - ); - 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://react.dev/link/strict-mode-string-ref" - ); - var 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 = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -1532,12 +1483,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -1545,9 +1496,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -1608,7 +1559,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -1948,52 +1899,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -2002,15 +1955,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -2022,12 +1975,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -2036,22 +1986,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -2092,17 +2038,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -9216,10 +9158,10 @@ var devToolsConfig$jscomp$inline_995 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "19.0.0-canary-0689007c", + version: "19.0.0-canary-6296ea1f", rendererPackageName: "react-test-renderer" }; -var internals$jscomp$inline_1185 = { +var internals$jscomp$inline_1215 = { bundleType: devToolsConfig$jscomp$inline_995.bundleType, version: devToolsConfig$jscomp$inline_995.version, rendererPackageName: devToolsConfig$jscomp$inline_995.rendererPackageName, @@ -9247,19 +9189,19 @@ var internals$jscomp$inline_1185 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-0689007c" + reconcilerVersion: "19.0.0-canary-6296ea1f" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1186 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1216 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1186.isDisabled && - hook$jscomp$inline_1186.supportsFiber + !hook$jscomp$inline_1216.isDisabled && + hook$jscomp$inline_1216.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1186.inject( - internals$jscomp$inline_1185 + (rendererID = hook$jscomp$inline_1216.inject( + internals$jscomp$inline_1215 )), - (injectedHook = hook$jscomp$inline_1186); + (injectedHook = hook$jscomp$inline_1216); } catch (err) {} } exports._Scheduler = Scheduler; 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 00aeb66066955..a8fc9a67fa5c7 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<<4f09bf783fcfd1bedefb736ffc52c17b>> */ "use strict"; @@ -1476,55 +1476,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") 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://react.dev/link/refs-must-have-owner for more information." - ); - 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://react.dev/link/strict-mode-string-ref" - ); - var 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 = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -1620,12 +1571,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -1633,9 +1584,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -1696,7 +1647,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -2036,52 +1987,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -2090,15 +2043,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -2110,12 +2063,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -2124,22 +2074,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -2180,17 +2126,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -9832,7 +9774,7 @@ var devToolsConfig$jscomp$inline_1079 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "19.0.0-canary-3aa3c53d", + version: "19.0.0-canary-99936a6e", rendererPackageName: "react-test-renderer" }; (function (internals) { @@ -9876,7 +9818,7 @@ var devToolsConfig$jscomp$inline_1079 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-3aa3c53d" + reconcilerVersion: "19.0.0-canary-99936a6e" }); exports._Scheduler = Scheduler; exports.act = act; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXDEVRuntime-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXDEVRuntime-dev.js index 51250fb57d633..4b0e19a81ac09 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXDEVRuntime-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXDEVRuntime-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -116,7 +116,7 @@ if (__DEV__) { var enableLegacyHidden = false; var enableTransitionTracing = false; - function getWrappedName(outerType, innerType, wrapperName) { + function getWrappedName$1(outerType, innerType, wrapperName) { var displayName = outerType.displayName; if (displayName) { @@ -129,7 +129,7 @@ if (__DEV__) { : wrapperName; } // Keep in sync with react-reconciler/getComponentNameFromFiber - function getContextName(type) { + function getContextName$1(type) { return type.displayName || "Context"; } @@ -190,28 +190,28 @@ if (__DEV__) { return null; } else { var provider = type; - return getContextName(provider._context) + ".Provider"; + return getContextName$1(provider._context) + ".Provider"; } case REACT_CONTEXT_TYPE: var context = type; if (enableRenderableContext) { - return getContextName(context) + ".Provider"; + return getContextName$1(context) + ".Provider"; } else { - return getContextName(context) + ".Consumer"; + return getContextName$1(context) + ".Consumer"; } case REACT_CONSUMER_TYPE: if (enableRenderableContext) { var consumer = type; - return getContextName(consumer._context) + ".Consumer"; + return getContextName$1(consumer._context) + ".Consumer"; } else { return null; } case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, "ForwardRef"); + return getWrappedName$1(type, type.render, "ForwardRef"); case REACT_MEMO_TYPE: var outerName = type.displayName || null; @@ -317,6 +317,20 @@ if (__DEV__) { } } } + function checkPropStringCoercion(value, propName) { + { + if (willCoercionThrow(value)) { + error( + "The provided `%s` prop is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + propName, + typeName(value) + ); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"); function isValidElementType(type) { @@ -829,6 +843,153 @@ if (__DEV__) { return ""; } + var FunctionComponent = 0; + var ClassComponent = 1; + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. + + var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. + + var HostComponent = 5; + var HostText = 6; + var Fragment = 7; + var Mode = 8; + var ContextConsumer = 9; + var ContextProvider = 10; + var ForwardRef = 11; + var Profiler = 12; + var SuspenseComponent = 13; + var MemoComponent = 14; + var SimpleMemoComponent = 15; + var LazyComponent = 16; + var IncompleteClassComponent = 17; + var DehydratedFragment = 18; + var SuspenseListComponent = 19; + var ScopeComponent = 21; + var OffscreenComponent = 22; + var CacheComponent = 24; + var TracingMarkerComponent = 25; + var HostHoistable = 26; + var HostSingleton = 27; + var IncompleteFunctionComponent = 28; + + function getWrappedName(outerType, innerType, wrapperName) { + var functionName = innerType.displayName || innerType.name || ""; + return ( + outerType.displayName || + (functionName !== "" + ? wrapperName + "(" + functionName + ")" + : wrapperName) + ); + } // Keep in sync with shared/getComponentNameFromType + + function getContextName(type) { + return type.displayName || "Context"; + } + + function getComponentNameFromFiber(fiber) { + var tag = fiber.tag, + type = fiber.type; + + switch (tag) { + case CacheComponent: + return "Cache"; + + case ContextConsumer: + if (enableRenderableContext) { + var consumer = type; + return getContextName(consumer._context) + ".Consumer"; + } else { + var context = type; + return getContextName(context) + ".Consumer"; + } + + case ContextProvider: + if (enableRenderableContext) { + var _context = type; + return getContextName(_context) + ".Provider"; + } else { + var provider = type; + return getContextName(provider._context) + ".Provider"; + } + + case DehydratedFragment: + return "DehydratedFragment"; + + case ForwardRef: + return getWrappedName(type, type.render, "ForwardRef"); + + case Fragment: + return "Fragment"; + + case HostHoistable: + case HostSingleton: + case HostComponent: + // Host component type is the display name (e.g. "div", "View") + return type; + + case HostPortal: + return "Portal"; + + case HostRoot: + return "Root"; + + case HostText: + return "Text"; + + case LazyComponent: + // Name comes from the type in this case; we don't have a tag. + return getComponentNameFromType(type); + + case Mode: + if (type === REACT_STRICT_MODE_TYPE) { + // Don't be less specific than shared/getComponentNameFromType + return "StrictMode"; + } + + return "Mode"; + + case OffscreenComponent: + return "Offscreen"; + + case Profiler: + return "Profiler"; + + case ScopeComponent: + return "Scope"; + + case SuspenseComponent: + return "Suspense"; + + case SuspenseListComponent: + return "SuspenseList"; + + case TracingMarkerComponent: + return "TracingMarker"; + // The display name for these tags come from the user-provided type: + + case IncompleteClassComponent: + case IncompleteFunctionComponent: + + // Fallthrough + + case ClassComponent: + case FunctionComponent: + case MemoComponent: + case SimpleMemoComponent: + if (typeof type === "function") { + return type.displayName || type.name || null; + } + + if (typeof type === "string") { + return type; + } + + break; + } + + return null; + } + var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); @@ -1171,6 +1332,10 @@ if (__DEV__) { if (hasValidRef(config)) { { ref = config.ref; + + { + ref = coerceStringRef(ref, ReactCurrentOwner.current, type); + } } { @@ -1184,7 +1349,9 @@ if (__DEV__) { propName !== "key" && propName !== "ref" ) { - props[propName] = config[propName]; + { + props[propName] = config[propName]; + } } } @@ -1442,6 +1609,96 @@ if (__DEV__) { } } + function coerceStringRef(mixedRef, owner, type) { + var stringRef; + + if (typeof mixedRef === "string") { + stringRef = mixedRef; + } else { + if (typeof mixedRef === "number" || typeof mixedRef === "boolean") { + { + checkPropStringCoercion(mixedRef, "ref"); + } + + stringRef = "" + mixedRef; + } else { + return mixedRef; + } + } + + return stringRefAsCallbackRef.bind(null, stringRef, type, owner); + } + + function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) { + throw new Error( + "Element ref was specified as a string (" + + stringRef + + ") 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://react.dev/link/refs-must-have-owner for more information." + ); + } + + 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://react.dev/link/strict-mode-string-ref" + ); + } + + { + if ( + // Will already warn with "Function components cannot be given refs" + !(typeof type === "function" && !isReactClass(type)) + ) { + var componentName = getComponentNameFromFiber(owner) || "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://react.dev/link/strict-mode-string-ref", + componentName, + stringRef + ); + + didWarnAboutStringRefs[componentName] = true; + } + } + } + + var inst = owner.stateNode; + + 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." + ); + } + + var refs = inst.refs; + + if (value === null) { + delete refs[stringRef]; + } else { + refs[stringRef] = value; + } + } + + function isReactClass(type) { + return type.prototype && type.prototype.isReactComponent; + } + var jsxDEV = jsxDEV$1; exports.Fragment = REACT_FRAGMENT_TYPE; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-dev.js index 5f049d7e557d0..bdc5ca9ddc181 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<282fb3cb626f5517884e1ac1196ba98f>> + * @generated SignedSource<<34a2867901178400502ec58badbb7a11>> */ "use strict"; @@ -116,7 +116,7 @@ if (__DEV__) { var enableLegacyHidden = false; var enableTransitionTracing = false; - function getWrappedName(outerType, innerType, wrapperName) { + function getWrappedName$1(outerType, innerType, wrapperName) { var displayName = outerType.displayName; if (displayName) { @@ -129,7 +129,7 @@ if (__DEV__) { : wrapperName; } // Keep in sync with react-reconciler/getComponentNameFromFiber - function getContextName(type) { + function getContextName$1(type) { return type.displayName || "Context"; } @@ -190,28 +190,28 @@ if (__DEV__) { return null; } else { var provider = type; - return getContextName(provider._context) + ".Provider"; + return getContextName$1(provider._context) + ".Provider"; } case REACT_CONTEXT_TYPE: var context = type; if (enableRenderableContext) { - return getContextName(context) + ".Provider"; + return getContextName$1(context) + ".Provider"; } else { - return getContextName(context) + ".Consumer"; + return getContextName$1(context) + ".Consumer"; } case REACT_CONSUMER_TYPE: if (enableRenderableContext) { var consumer = type; - return getContextName(consumer._context) + ".Consumer"; + return getContextName$1(consumer._context) + ".Consumer"; } else { return null; } case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, "ForwardRef"); + return getWrappedName$1(type, type.render, "ForwardRef"); case REACT_MEMO_TYPE: var outerName = type.displayName || null; @@ -317,6 +317,20 @@ if (__DEV__) { } } } + function checkPropStringCoercion(value, propName) { + { + if (willCoercionThrow(value)) { + error( + "The provided `%s` prop is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + propName, + typeName(value) + ); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"); function isValidElementType(type) { @@ -829,6 +843,153 @@ if (__DEV__) { return ""; } + var FunctionComponent = 0; + var ClassComponent = 1; + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. + + var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. + + var HostComponent = 5; + var HostText = 6; + var Fragment = 7; + var Mode = 8; + var ContextConsumer = 9; + var ContextProvider = 10; + var ForwardRef = 11; + var Profiler = 12; + var SuspenseComponent = 13; + var MemoComponent = 14; + var SimpleMemoComponent = 15; + var LazyComponent = 16; + var IncompleteClassComponent = 17; + var DehydratedFragment = 18; + var SuspenseListComponent = 19; + var ScopeComponent = 21; + var OffscreenComponent = 22; + var CacheComponent = 24; + var TracingMarkerComponent = 25; + var HostHoistable = 26; + var HostSingleton = 27; + var IncompleteFunctionComponent = 28; + + function getWrappedName(outerType, innerType, wrapperName) { + var functionName = innerType.displayName || innerType.name || ""; + return ( + outerType.displayName || + (functionName !== "" + ? wrapperName + "(" + functionName + ")" + : wrapperName) + ); + } // Keep in sync with shared/getComponentNameFromType + + function getContextName(type) { + return type.displayName || "Context"; + } + + function getComponentNameFromFiber(fiber) { + var tag = fiber.tag, + type = fiber.type; + + switch (tag) { + case CacheComponent: + return "Cache"; + + case ContextConsumer: + if (enableRenderableContext) { + var consumer = type; + return getContextName(consumer._context) + ".Consumer"; + } else { + var context = type; + return getContextName(context) + ".Consumer"; + } + + case ContextProvider: + if (enableRenderableContext) { + var _context = type; + return getContextName(_context) + ".Provider"; + } else { + var provider = type; + return getContextName(provider._context) + ".Provider"; + } + + case DehydratedFragment: + return "DehydratedFragment"; + + case ForwardRef: + return getWrappedName(type, type.render, "ForwardRef"); + + case Fragment: + return "Fragment"; + + case HostHoistable: + case HostSingleton: + case HostComponent: + // Host component type is the display name (e.g. "div", "View") + return type; + + case HostPortal: + return "Portal"; + + case HostRoot: + return "Root"; + + case HostText: + return "Text"; + + case LazyComponent: + // Name comes from the type in this case; we don't have a tag. + return getComponentNameFromType(type); + + case Mode: + if (type === REACT_STRICT_MODE_TYPE) { + // Don't be less specific than shared/getComponentNameFromType + return "StrictMode"; + } + + return "Mode"; + + case OffscreenComponent: + return "Offscreen"; + + case Profiler: + return "Profiler"; + + case ScopeComponent: + return "Scope"; + + case SuspenseComponent: + return "Suspense"; + + case SuspenseListComponent: + return "SuspenseList"; + + case TracingMarkerComponent: + return "TracingMarker"; + // The display name for these tags come from the user-provided type: + + case IncompleteClassComponent: + case IncompleteFunctionComponent: + + // Fallthrough + + case ClassComponent: + case FunctionComponent: + case MemoComponent: + case SimpleMemoComponent: + if (typeof type === "function") { + return type.displayName || type.name || null; + } + + if (typeof type === "string") { + return type; + } + + break; + } + + return null; + } + var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); @@ -1207,6 +1368,10 @@ if (__DEV__) { if (hasValidRef(config)) { { ref = config.ref; + + { + ref = coerceStringRef(ref, ReactCurrentOwner.current, type); + } } { @@ -1220,7 +1385,9 @@ if (__DEV__) { propName !== "key" && propName !== "ref" ) { - props[propName] = config[propName]; + { + props[propName] = config[propName]; + } } } @@ -1478,6 +1645,96 @@ if (__DEV__) { } } + function coerceStringRef(mixedRef, owner, type) { + var stringRef; + + if (typeof mixedRef === "string") { + stringRef = mixedRef; + } else { + if (typeof mixedRef === "number" || typeof mixedRef === "boolean") { + { + checkPropStringCoercion(mixedRef, "ref"); + } + + stringRef = "" + mixedRef; + } else { + return mixedRef; + } + } + + return stringRefAsCallbackRef.bind(null, stringRef, type, owner); + } + + function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) { + throw new Error( + "Element ref was specified as a string (" + + stringRef + + ") 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://react.dev/link/refs-must-have-owner for more information." + ); + } + + 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://react.dev/link/strict-mode-string-ref" + ); + } + + { + if ( + // Will already warn with "Function components cannot be given refs" + !(typeof type === "function" && !isReactClass(type)) + ) { + var componentName = getComponentNameFromFiber(owner) || "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://react.dev/link/strict-mode-string-ref", + componentName, + stringRef + ); + + didWarnAboutStringRefs[componentName] = true; + } + } + } + + var inst = owner.stateNode; + + 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." + ); + } + + var refs = inst.refs; + + if (value === null) { + delete refs[stringRef]; + } else { + refs[stringRef] = value; + } + } + + function isReactClass(type) { + return type.prototype && type.prototype.isReactComponent; + } + var jsx = jsxProdSignatureRunningInDevWithDynamicChildren; // we may want to special case jsxs internally to take advantage of static children. // for now we can ship identical prod functions diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-prod.js index 298e91ad698ae..a4a5a5aeb198a 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-prod.js @@ -7,15 +7,30 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<26fbc8eee6902991682d526f8537439c>> + * @generated SignedSource<<95871e7bee6e8808b03f8a095c660457>> */ "use strict"; var dynamicFlagsUntyped = require("ReactNativeInternalFeatureFlags"), React = require("react"), REACT_ELEMENT_TYPE = Symbol.for("react.element"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - disableDefaultPropsExceptForClasses = + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +function formatProdErrorMessage(code) { + var url = "https://react.dev/errors/" + code; + if (1 < arguments.length) { + url += "?args[]=" + encodeURIComponent(arguments[1]); + for (var i = 2; i < arguments.length; i++) + url += "&args[]=" + encodeURIComponent(arguments[i]); + } + return ( + "Minified React error #" + + code + + "; visit " + + url + + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." + ); +} +var disableDefaultPropsExceptForClasses = dynamicFlagsUntyped.disableDefaultPropsExceptForClasses, hasOwnProperty = Object.prototype.hasOwnProperty, ReactCurrentOwner = @@ -27,7 +42,18 @@ function jsxProd(type, config, maybeKey) { ref = null; void 0 !== maybeKey && (key = "" + maybeKey); void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); + if (void 0 !== config.ref) + a: { + if (((ref = config.ref), "string" !== typeof ref)) + if ("number" === typeof ref || "boolean" === typeof ref) ref = "" + ref; + else break a; + ref = stringRefAsCallbackRef.bind( + null, + ref, + type, + ReactCurrentOwner.current + ); + } for (propName in config) hasOwnProperty.call(config, propName) && "key" !== propName && @@ -45,6 +71,14 @@ function jsxProd(type, config, maybeKey) { _owner: ReactCurrentOwner.current }; } +function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) throw Error(formatProdErrorMessage(290, stringRef)); + if (1 !== owner.tag) throw Error(formatProdErrorMessage(309)); + type = owner.stateNode; + if (!type) throw Error(formatProdErrorMessage(147, stringRef)); + type = type.refs; + null === value ? delete type[stringRef] : (type[stringRef] = value); +} exports.Fragment = REACT_FRAGMENT_TYPE; exports.jsx = jsxProd; exports.jsxs = jsxProd; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-profiling.js index 298e91ad698ae..a4a5a5aeb198a 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-profiling.js @@ -7,15 +7,30 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<26fbc8eee6902991682d526f8537439c>> + * @generated SignedSource<<95871e7bee6e8808b03f8a095c660457>> */ "use strict"; var dynamicFlagsUntyped = require("ReactNativeInternalFeatureFlags"), React = require("react"), REACT_ELEMENT_TYPE = Symbol.for("react.element"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - disableDefaultPropsExceptForClasses = + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +function formatProdErrorMessage(code) { + var url = "https://react.dev/errors/" + code; + if (1 < arguments.length) { + url += "?args[]=" + encodeURIComponent(arguments[1]); + for (var i = 2; i < arguments.length; i++) + url += "&args[]=" + encodeURIComponent(arguments[i]); + } + return ( + "Minified React error #" + + code + + "; visit " + + url + + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." + ); +} +var disableDefaultPropsExceptForClasses = dynamicFlagsUntyped.disableDefaultPropsExceptForClasses, hasOwnProperty = Object.prototype.hasOwnProperty, ReactCurrentOwner = @@ -27,7 +42,18 @@ function jsxProd(type, config, maybeKey) { ref = null; void 0 !== maybeKey && (key = "" + maybeKey); void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); + if (void 0 !== config.ref) + a: { + if (((ref = config.ref), "string" !== typeof ref)) + if ("number" === typeof ref || "boolean" === typeof ref) ref = "" + ref; + else break a; + ref = stringRefAsCallbackRef.bind( + null, + ref, + type, + ReactCurrentOwner.current + ); + } for (propName in config) hasOwnProperty.call(config, propName) && "key" !== propName && @@ -45,6 +71,14 @@ function jsxProd(type, config, maybeKey) { _owner: ReactCurrentOwner.current }; } +function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) throw Error(formatProdErrorMessage(290, stringRef)); + if (1 !== owner.tag) throw Error(formatProdErrorMessage(309)); + type = owner.stateNode; + if (!type) throw Error(formatProdErrorMessage(147, stringRef)); + type = type.refs; + null === value ? delete type[stringRef] : (type[stringRef] = value); +} exports.Fragment = REACT_FRAGMENT_TYPE; exports.jsx = jsxProd; exports.jsxs = jsxProd; 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 9407a22d463d7..970568b953cef 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 @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<25217836b8f863c9d7a02187e9851881>> */ "use strict"; @@ -26,7 +26,7 @@ if (__DEV__) { } var dynamicFlagsUntyped = require("ReactNativeInternalFeatureFlags"); - var ReactVersion = "19.0.0-canary-1e7b10f9"; + var ReactVersion = "19.0.0-canary-135898c8"; // ATTENTION // When adding new symbols to this file, @@ -564,6 +564,20 @@ if (__DEV__) { } } } + function checkPropStringCoercion(value, propName) { + { + if (willCoercionThrow(value)) { + error( + "The provided `%s` prop is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + propName, + typeName(value) + ); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } // Re-export dynamic flags from the internal module. var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-exporting to avoid a dynamic look-up on @@ -584,7 +598,7 @@ if (__DEV__) { var enableRefAsProp = false; var disableLegacyMode = false; - function getWrappedName(outerType, innerType, wrapperName) { + function getWrappedName$1(outerType, innerType, wrapperName) { var displayName = outerType.displayName; if (displayName) { @@ -597,7 +611,7 @@ if (__DEV__) { : wrapperName; } // Keep in sync with react-reconciler/getComponentNameFromFiber - function getContextName(type) { + function getContextName$1(type) { return type.displayName || "Context"; } @@ -658,28 +672,28 @@ if (__DEV__) { return null; } else { var provider = type; - return getContextName(provider._context) + ".Provider"; + return getContextName$1(provider._context) + ".Provider"; } case REACT_CONTEXT_TYPE: var context = type; if (enableRenderableContext) { - return getContextName(context) + ".Provider"; + return getContextName$1(context) + ".Provider"; } else { - return getContextName(context) + ".Consumer"; + return getContextName$1(context) + ".Consumer"; } case REACT_CONSUMER_TYPE: if (enableRenderableContext) { var consumer = type; - return getContextName(consumer._context) + ".Consumer"; + return getContextName$1(consumer._context) + ".Consumer"; } else { return null; } case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, "ForwardRef"); + return getWrappedName$1(type, type.render, "ForwardRef"); case REACT_MEMO_TYPE: var outerName = type.displayName || null; @@ -1215,6 +1229,153 @@ if (__DEV__) { return ""; } + var FunctionComponent = 0; + var ClassComponent = 1; + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. + + var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. + + var HostComponent = 5; + var HostText = 6; + var Fragment = 7; + var Mode = 8; + var ContextConsumer = 9; + var ContextProvider = 10; + var ForwardRef = 11; + var Profiler = 12; + var SuspenseComponent = 13; + var MemoComponent = 14; + var SimpleMemoComponent = 15; + var LazyComponent = 16; + var IncompleteClassComponent = 17; + var DehydratedFragment = 18; + var SuspenseListComponent = 19; + var ScopeComponent = 21; + var OffscreenComponent = 22; + var CacheComponent = 24; + var TracingMarkerComponent = 25; + var HostHoistable = 26; + var HostSingleton = 27; + var IncompleteFunctionComponent = 28; + + function getWrappedName(outerType, innerType, wrapperName) { + var functionName = innerType.displayName || innerType.name || ""; + return ( + outerType.displayName || + (functionName !== "" + ? wrapperName + "(" + functionName + ")" + : wrapperName) + ); + } // Keep in sync with shared/getComponentNameFromType + + function getContextName(type) { + return type.displayName || "Context"; + } + + function getComponentNameFromFiber(fiber) { + var tag = fiber.tag, + type = fiber.type; + + switch (tag) { + case CacheComponent: + return "Cache"; + + case ContextConsumer: + if (enableRenderableContext) { + var consumer = type; + return getContextName(consumer._context) + ".Consumer"; + } else { + var context = type; + return getContextName(context) + ".Consumer"; + } + + case ContextProvider: + if (enableRenderableContext) { + var _context = type; + return getContextName(_context) + ".Provider"; + } else { + var provider = type; + return getContextName(provider._context) + ".Provider"; + } + + case DehydratedFragment: + return "DehydratedFragment"; + + case ForwardRef: + return getWrappedName(type, type.render, "ForwardRef"); + + case Fragment: + return "Fragment"; + + case HostHoistable: + case HostSingleton: + case HostComponent: + // Host component type is the display name (e.g. "div", "View") + return type; + + case HostPortal: + return "Portal"; + + case HostRoot: + return "Root"; + + case HostText: + return "Text"; + + case LazyComponent: + // Name comes from the type in this case; we don't have a tag. + return getComponentNameFromType(type); + + case Mode: + if (type === REACT_STRICT_MODE_TYPE) { + // Don't be less specific than shared/getComponentNameFromType + return "StrictMode"; + } + + return "Mode"; + + case OffscreenComponent: + return "Offscreen"; + + case Profiler: + return "Profiler"; + + case ScopeComponent: + return "Scope"; + + case SuspenseComponent: + return "Suspense"; + + case SuspenseListComponent: + return "SuspenseList"; + + case TracingMarkerComponent: + return "TracingMarker"; + // The display name for these tags come from the user-provided type: + + case IncompleteClassComponent: + case IncompleteFunctionComponent: + + // Fallthrough + + case ClassComponent: + case FunctionComponent: + case MemoComponent: + case SimpleMemoComponent: + if (typeof type === "function") { + return type.displayName || type.name || null; + } + + if (typeof type === "string") { + return type; + } + + break; + } + + return null; + } + var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); @@ -1593,6 +1754,10 @@ if (__DEV__) { if (hasValidRef(config)) { { ref = config.ref; + + { + ref = coerceStringRef(ref, ReactCurrentOwner.current, type); + } } { @@ -1606,7 +1771,9 @@ if (__DEV__) { propName !== "key" && propName !== "ref" ) { - props[propName] = config[propName]; + { + props[propName] = config[propName]; + } } } @@ -1728,6 +1895,10 @@ if (__DEV__) { if (hasValidRef(config)) { { ref = config.ref; + + { + ref = coerceStringRef(ref, ReactCurrentOwner.current, type); + } } { @@ -1754,7 +1925,9 @@ if (__DEV__) { propName !== "__self" && propName !== "__source" ) { - props[propName] = config[propName]; + { + props[propName] = config[propName]; + } } } } // Children can be more than one argument, and those are transferred onto @@ -1863,6 +2036,10 @@ if (__DEV__) { { // Silently steal the ref from the parent. ref = config.ref; + + { + ref = coerceStringRef(ref, owner, element.type); + } } owner = ReactCurrentOwner.current; @@ -1910,7 +2087,9 @@ if (__DEV__) { // Resolve default props props[propName] = defaultProps[propName]; } else { - props[propName] = config[propName]; + { + props[propName] = config[propName]; + } } } } @@ -2156,6 +2335,96 @@ if (__DEV__) { } } + function coerceStringRef(mixedRef, owner, type) { + var stringRef; + + if (typeof mixedRef === "string") { + stringRef = mixedRef; + } else { + if (typeof mixedRef === "number" || typeof mixedRef === "boolean") { + { + checkPropStringCoercion(mixedRef, "ref"); + } + + stringRef = "" + mixedRef; + } else { + return mixedRef; + } + } + + return stringRefAsCallbackRef.bind(null, stringRef, type, owner); + } + + function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) { + throw new Error( + "Element ref was specified as a string (" + + stringRef + + ") 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://react.dev/link/refs-must-have-owner for more information." + ); + } + + 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://react.dev/link/strict-mode-string-ref" + ); + } + + { + if ( + // Will already warn with "Function components cannot be given refs" + !(typeof type === "function" && !isReactClass(type)) + ) { + var componentName = getComponentNameFromFiber(owner) || "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://react.dev/link/strict-mode-string-ref", + componentName, + stringRef + ); + + didWarnAboutStringRefs[componentName] = true; + } + } + } + + var inst = owner.stateNode; + + 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." + ); + } + + var refs = inst.refs; + + if (value === null) { + delete refs[stringRef]; + } else { + refs[stringRef] = value; + } + } + + function isReactClass(type) { + return type.prototype && type.prototype.isReactComponent; + } + var SEPARATOR = "."; var SUBSEPARATOR = ":"; /** 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 6ede3f820898a..41f6dae276c43 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 @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<1d4dfe262135ef97303d2935beb2bc9f>> */ "use strict"; @@ -114,7 +114,9 @@ function jsxProd(type, config, maybeKey) { ref = null; void 0 !== maybeKey && (key = "" + maybeKey); void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); + void 0 !== config.ref && + ((ref = config.ref), + (ref = coerceStringRef(ref, ReactCurrentOwner.current, type))); for (propName in config) hasOwnProperty.call(config, propName) && "key" !== propName && @@ -151,6 +153,34 @@ function isValidElement(object) { object.$$typeof === REACT_ELEMENT_TYPE ); } +function coerceStringRef(mixedRef, owner, type) { + if ("string" !== typeof mixedRef) + if ("number" === typeof mixedRef || "boolean" === typeof mixedRef) + mixedRef = "" + mixedRef; + else return mixedRef; + return stringRefAsCallbackRef.bind(null, mixedRef, type, owner); +} +function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) + throw Error( + "Element ref was specified as a string (" + + stringRef + + ") 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://react.dev/link/refs-must-have-owner for more information." + ); + if (1 !== owner.tag) + throw Error( + "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref" + ); + type = owner.stateNode; + if (!type) + throw Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a bug in React. Please file an issue." + ); + type = type.refs; + null === value ? delete type[stringRef] : (type[stringRef] = value); +} function escape(key) { var escaperLookup = { "=": "=0", ":": "=2" }; return ( @@ -425,7 +455,9 @@ exports.cloneElement = function (element, config, children) { owner = element._owner; if (null != config) { void 0 !== config.ref && - ((ref = config.ref), (owner = ReactCurrentOwner.current)); + ((ref = config.ref), + (ref = coerceStringRef(ref, owner, element.type)), + (owner = ReactCurrentOwner.current)); void 0 !== config.key && (key = "" + config.key); if ( !disableDefaultPropsExceptForClasses && @@ -483,7 +515,9 @@ exports.createElement = function (type, config, children) { key = null, ref = null; if (null != config) - for (propName in (void 0 !== config.ref && (ref = config.ref), + for (propName in (void 0 !== config.ref && + ((ref = config.ref), + (ref = coerceStringRef(ref, ReactCurrentOwner.current, type))), void 0 !== config.key && (key = "" + config.key), config)) hasOwnProperty.call(config, propName) && @@ -649,4 +683,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "19.0.0-canary-c781fee2"; +exports.version = "19.0.0-canary-54d35464"; 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 d9cbcae7abca3..fefa416d6c2d2 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 @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<3a211c656ba13ce7f2fa442cb1420f88>> */ "use strict"; @@ -118,7 +118,9 @@ function jsxProd(type, config, maybeKey) { ref = null; void 0 !== maybeKey && (key = "" + maybeKey); void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); + void 0 !== config.ref && + ((ref = config.ref), + (ref = coerceStringRef(ref, ReactCurrentOwner.current, type))); for (propName in config) hasOwnProperty.call(config, propName) && "key" !== propName && @@ -155,6 +157,34 @@ function isValidElement(object) { object.$$typeof === REACT_ELEMENT_TYPE ); } +function coerceStringRef(mixedRef, owner, type) { + if ("string" !== typeof mixedRef) + if ("number" === typeof mixedRef || "boolean" === typeof mixedRef) + mixedRef = "" + mixedRef; + else return mixedRef; + return stringRefAsCallbackRef.bind(null, mixedRef, type, owner); +} +function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) + throw Error( + "Element ref was specified as a string (" + + stringRef + + ") 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://react.dev/link/refs-must-have-owner for more information." + ); + if (1 !== owner.tag) + throw Error( + "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref" + ); + type = owner.stateNode; + if (!type) + throw Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a bug in React. Please file an issue." + ); + type = type.refs; + null === value ? delete type[stringRef] : (type[stringRef] = value); +} function escape(key) { var escaperLookup = { "=": "=0", ":": "=2" }; return ( @@ -429,7 +459,9 @@ exports.cloneElement = function (element, config, children) { owner = element._owner; if (null != config) { void 0 !== config.ref && - ((ref = config.ref), (owner = ReactCurrentOwner.current)); + ((ref = config.ref), + (ref = coerceStringRef(ref, owner, element.type)), + (owner = ReactCurrentOwner.current)); void 0 !== config.key && (key = "" + config.key); if ( !disableDefaultPropsExceptForClasses && @@ -487,7 +519,9 @@ exports.createElement = function (type, config, children) { key = null, ref = null; if (null != config) - for (propName in (void 0 !== config.ref && (ref = config.ref), + for (propName in (void 0 !== config.ref && + ((ref = config.ref), + (ref = coerceStringRef(ref, ReactCurrentOwner.current, type))), void 0 !== config.key && (key = "" + config.key), config)) hasOwnProperty.call(config, propName) && @@ -653,7 +687,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "19.0.0-canary-46b57fd6"; +exports.version = "19.0.0-canary-158ab85d"; "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 efcac2c6f957e..c5ec26ad631b8 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 @@ -48b4ecc9012638ed51b275aad24b2086b8215e32 +e3ebcd54b98a4f8f5a9f7e63982fa75578b648ed 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 c294fe0e4c62a..032b43c5a9824 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<> + * @generated SignedSource<> */ "use strict"; @@ -9112,94 +9112,6 @@ to return true:wantsResponderID| | }; } - /* - * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol - * and Temporal.* types. See https://github.com/facebook/react/pull/22064. - * - * The functions in this module will throw an easier-to-understand, - * easier-to-debug exception with a clear errors message message explaining the - * problem. (Instead of a confusing exception thrown inside the implementation - * of the `value` object). - */ - // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - function typeName(value) { - { - // toStringTag is needed for namespaced types like Temporal.Instant - var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; - var type = - (hasToStringTag && value[Symbol.toStringTag]) || - value.constructor.name || - "Object"; // $FlowFixMe[incompatible-return] - - return type; - } - } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - - function willCoercionThrow(value) { - { - try { - testStringCoercion(value); - return false; - } catch (e) { - return true; - } - } - } - - function testStringCoercion(value) { - // If you ended up here by following an exception call stack, here's what's - // happened: you supplied an object or symbol value to React (as a prop, key, - // DOM attribute, CSS property, string ref, etc.) and when React tried to - // coerce it to a string using `'' + value`, an exception was thrown. - // - // The most common types that will cause this exception are `Symbol` instances - // and Temporal objects like `Temporal.Instant`. But any object that has a - // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this - // exception. (Library authors do this to prevent users from using built-in - // numeric operators like `+` or comparison operators like `>=` because custom - // methods are needed to perform accurate arithmetic or comparison.) - // - // To fix the problem, coerce this object or symbol value to a string before - // passing it to React. The most reliable way is usually `String(value)`. - // - // To find which value is throwing, check the browser or debugger console. - // Before this exception was thrown, there should be `console.error` output - // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the - // problem and how that type was used: key, atrribute, input value prop, etc. - // In most cases, this console output also shows the component and its - // ancestor components where the exception happened. - // - // eslint-disable-next-line react-internal/safe-string-coercion - return "" + value; - } - function checkKeyStringCoercion(value) { - { - if (willCoercionThrow(value)) { - error( - "The provided key is an unsupported type %s." + - " This value must be coerced to a string before using it here.", - typeName(value) - ); - - return testStringCoercion(value); // throw (to help callers find troubleshooting comments) - } - } - } - function checkPropStringCoercion(value, propName) { - { - if (willCoercionThrow(value)) { - error( - "The provided `%s` prop is an unsupported type %s." + - " This value must be coerced to a string before using it here.", - propName, - typeName(value) - ); - - return testStringCoercion(value); // throw (to help callers find troubleshooting comments) - } - } - } - var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; function getThenablesFromState(state) { @@ -9479,7 +9391,6 @@ to return true:wantsResponderID| | var didWarnAboutMaps; var didWarnAboutGenerators; - var didWarnAboutStringRefs; var ownerHasKeyUseWarning; var ownerHasFunctionTypeWarning; var ownerHasSymbolTypeWarning; @@ -9489,7 +9400,6 @@ to return true:wantsResponderID| | { didWarnAboutMaps = false; didWarnAboutGenerators = false; - didWarnAboutStringRefs = {}; /** * Warn if there's no key explicitly set on dynamic arrays of children or * object keys are not valid. This allows us to keep track of children between @@ -9534,10 +9444,6 @@ to return true:wantsResponderID| | }; } - function isReactClass(type) { - return type.prototype && type.prototype.isReactComponent; - } - function unwrapThenable(thenable) { var index = thenableIndexCounter$1; thenableIndexCounter$1 += 1; @@ -9549,128 +9455,16 @@ to return true:wantsResponderID| | return trackUsedThenable(thenableState$1, thenable, index); } - function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ) { - { - checkPropStringCoercion(mixedRef, "ref"); - } - - var stringRef = "" + mixedRef; - var owner = element._owner; - - if (!owner) { - throw new Error( - "Element ref was specified as a string (" + - stringRef + - ") 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://react.dev/link/refs-must-have-owner for more information." - ); - } - - 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://react.dev/link/strict-mode-string-ref" - ); - } - - { - if ( - // Will already warn with "Function components cannot be given refs" - !(typeof element.type === "function" && !isReactClass(element.type)) - ) { - 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://react.dev/link/strict-mode-string-ref", - componentName, - stringRef - ); - - didWarnAboutStringRefs[componentName] = true; - } - } - } - - var inst = owner.stateNode; - - 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 - - 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 - - var ref = function (value) { - var refs = inst.refs; - - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; - - ref._stringRef = stringRef; - return ref; - } - function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef; + var ref; { // Old behavior. - mixedRef = element.ref; - } - - var coercedRef; - - if ( - typeof mixedRef === "string" || - typeof mixedRef === "number" || - typeof mixedRef === "boolean" - ) { - coercedRef = convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ); - } else { - coercedRef = mixedRef; + ref = element.ref; } // TODO: If enableRefAsProp is on, we shouldn't use the `ref` field. We // should always read the ref from the prop. - workInProgress.ref = coercedRef; + workInProgress.ref = ref; } function throwOnInvalidObjectType(returnFiber, newChild) { @@ -30530,7 +30324,81 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "19.0.0-canary-966bda36"; + var ReactVersion = "19.0.0-canary-b1b2d552"; + + /* + * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ + // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; + var type = + (hasToStringTag && value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; // $FlowFixMe[incompatible-return] + + return type; + } + } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + + function willCoercionThrow(value) { + { + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } + } + + function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + return "" + value; + } + function checkKeyStringCoercion(value) { + { + if (willCoercionThrow(value)) { + error( + "The provided key is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + typeName(value) + ); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } 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 4fd68709bed01..c2619b29f1f71 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<<224bcce6fb232bb63170272f6821f359>> + * @generated SignedSource<<01cc9f284c60ab4c10d734765170f7b0>> */ "use strict"; @@ -2900,55 +2900,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") 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://react.dev/link/refs-must-have-owner for more information." - ); - 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://react.dev/link/strict-mode-string-ref" - ); - var 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 = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -3044,12 +2995,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -3057,9 +3008,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -3120,7 +3071,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -3460,52 +3411,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -3514,15 +3467,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -3534,12 +3487,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3548,22 +3498,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -3604,17 +3550,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -10641,7 +10583,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1096 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "19.0.0-canary-e9ef48bd", + version: "19.0.0-canary-c6df369f", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10657,7 +10599,7 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1335 = { +var internals$jscomp$inline_1365 = { bundleType: devToolsConfig$jscomp$inline_1096.bundleType, version: devToolsConfig$jscomp$inline_1096.version, rendererPackageName: devToolsConfig$jscomp$inline_1096.rendererPackageName, @@ -10684,19 +10626,19 @@ var internals$jscomp$inline_1335 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-e9ef48bd" + reconcilerVersion: "19.0.0-canary-c6df369f" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1336 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1366 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1336.isDisabled && - hook$jscomp$inline_1336.supportsFiber + !hook$jscomp$inline_1366.isDisabled && + hook$jscomp$inline_1366.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1336.inject( - internals$jscomp$inline_1335 + (rendererID = hook$jscomp$inline_1366.inject( + internals$jscomp$inline_1365 )), - (injectedHook = hook$jscomp$inline_1336); + (injectedHook = hook$jscomp$inline_1366); } catch (err) {} } exports.createPortal = function (children, containerTag) { 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 31beee3508e6f..1d5698d73e9cd 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<<73c6c2752bbd85d9ac37604b580550af>> + * @generated SignedSource<<7fd85bca5634967543dd407b6f7f3ba8>> */ "use strict"; @@ -3022,55 +3022,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") 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://react.dev/link/refs-must-have-owner for more information." - ); - 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://react.dev/link/strict-mode-string-ref" - ); - var 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 = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -3166,12 +3117,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -3179,9 +3130,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -3242,7 +3193,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -3582,52 +3533,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -3636,15 +3589,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -3656,12 +3609,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3670,22 +3620,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -3726,17 +3672,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -11346,7 +11288,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1178 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "19.0.0-canary-9599a17c", + version: "19.0.0-canary-f1c8d3cc", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11402,7 +11344,7 @@ var roots = new Map(), scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-9599a17c" + reconcilerVersion: "19.0.0-canary-f1c8d3cc" }); 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 3bc2b2f2d95b6..a4af5769e3fb6 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<> + * @generated SignedSource<<84974333a026e7d4a4581ef55ac96e5e>> */ "use strict"; @@ -9383,94 +9383,6 @@ to return true:wantsResponderID| | }; } - /* - * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol - * and Temporal.* types. See https://github.com/facebook/react/pull/22064. - * - * The functions in this module will throw an easier-to-understand, - * easier-to-debug exception with a clear errors message message explaining the - * problem. (Instead of a confusing exception thrown inside the implementation - * of the `value` object). - */ - // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - function typeName(value) { - { - // toStringTag is needed for namespaced types like Temporal.Instant - var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; - var type = - (hasToStringTag && value[Symbol.toStringTag]) || - value.constructor.name || - "Object"; // $FlowFixMe[incompatible-return] - - return type; - } - } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - - function willCoercionThrow(value) { - { - try { - testStringCoercion(value); - return false; - } catch (e) { - return true; - } - } - } - - function testStringCoercion(value) { - // If you ended up here by following an exception call stack, here's what's - // happened: you supplied an object or symbol value to React (as a prop, key, - // DOM attribute, CSS property, string ref, etc.) and when React tried to - // coerce it to a string using `'' + value`, an exception was thrown. - // - // The most common types that will cause this exception are `Symbol` instances - // and Temporal objects like `Temporal.Instant`. But any object that has a - // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this - // exception. (Library authors do this to prevent users from using built-in - // numeric operators like `+` or comparison operators like `>=` because custom - // methods are needed to perform accurate arithmetic or comparison.) - // - // To fix the problem, coerce this object or symbol value to a string before - // passing it to React. The most reliable way is usually `String(value)`. - // - // To find which value is throwing, check the browser or debugger console. - // Before this exception was thrown, there should be `console.error` output - // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the - // problem and how that type was used: key, atrribute, input value prop, etc. - // In most cases, this console output also shows the component and its - // ancestor components where the exception happened. - // - // eslint-disable-next-line react-internal/safe-string-coercion - return "" + value; - } - function checkKeyStringCoercion(value) { - { - if (willCoercionThrow(value)) { - error( - "The provided key is an unsupported type %s." + - " This value must be coerced to a string before using it here.", - typeName(value) - ); - - return testStringCoercion(value); // throw (to help callers find troubleshooting comments) - } - } - } - function checkPropStringCoercion(value, propName) { - { - if (willCoercionThrow(value)) { - error( - "The provided `%s` prop is an unsupported type %s." + - " This value must be coerced to a string before using it here.", - propName, - typeName(value) - ); - - return testStringCoercion(value); // throw (to help callers find troubleshooting comments) - } - } - } - var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; function getThenablesFromState(state) { @@ -9750,7 +9662,6 @@ to return true:wantsResponderID| | var didWarnAboutMaps; var didWarnAboutGenerators; - var didWarnAboutStringRefs; var ownerHasKeyUseWarning; var ownerHasFunctionTypeWarning; var ownerHasSymbolTypeWarning; @@ -9760,7 +9671,6 @@ to return true:wantsResponderID| | { didWarnAboutMaps = false; didWarnAboutGenerators = false; - didWarnAboutStringRefs = {}; /** * Warn if there's no key explicitly set on dynamic arrays of children or * object keys are not valid. This allows us to keep track of children between @@ -9805,10 +9715,6 @@ to return true:wantsResponderID| | }; } - function isReactClass(type) { - return type.prototype && type.prototype.isReactComponent; - } - function unwrapThenable(thenable) { var index = thenableIndexCounter$1; thenableIndexCounter$1 += 1; @@ -9820,128 +9726,16 @@ to return true:wantsResponderID| | return trackUsedThenable(thenableState$1, thenable, index); } - function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ) { - { - checkPropStringCoercion(mixedRef, "ref"); - } - - var stringRef = "" + mixedRef; - var owner = element._owner; - - if (!owner) { - throw new Error( - "Element ref was specified as a string (" + - stringRef + - ") 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://react.dev/link/refs-must-have-owner for more information." - ); - } - - 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://react.dev/link/strict-mode-string-ref" - ); - } - - { - if ( - // Will already warn with "Function components cannot be given refs" - !(typeof element.type === "function" && !isReactClass(element.type)) - ) { - 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://react.dev/link/strict-mode-string-ref", - componentName, - stringRef - ); - - didWarnAboutStringRefs[componentName] = true; - } - } - } - - var inst = owner.stateNode; - - 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 - - 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 - - var ref = function (value) { - var refs = inst.refs; - - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; - - ref._stringRef = stringRef; - return ref; - } - function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef; + var ref; { // Old behavior. - mixedRef = element.ref; - } - - var coercedRef; - - if ( - typeof mixedRef === "string" || - typeof mixedRef === "number" || - typeof mixedRef === "boolean" - ) { - coercedRef = convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ); - } else { - coercedRef = mixedRef; + ref = element.ref; } // TODO: If enableRefAsProp is on, we shouldn't use the `ref` field. We // should always read the ref from the prop. - workInProgress.ref = coercedRef; + workInProgress.ref = ref; } function throwOnInvalidObjectType(returnFiber, newChild) { @@ -30970,7 +30764,81 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "19.0.0-canary-997c5634"; + var ReactVersion = "19.0.0-canary-6dea6299"; + + /* + * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ + // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; + var type = + (hasToStringTag && value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; // $FlowFixMe[incompatible-return] + + return type; + } + } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + + function willCoercionThrow(value) { + { + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } + } + + function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + return "" + value; + } + function checkKeyStringCoercion(value) { + { + if (willCoercionThrow(value)) { + error( + "The provided key is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + typeName(value) + ); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } 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 3cdbc6e2ecce4..c7f3e08248888 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<> */ "use strict"; @@ -2965,55 +2965,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") 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://react.dev/link/refs-must-have-owner for more information." - ); - 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://react.dev/link/strict-mode-string-ref" - ); - var 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 = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -3109,12 +3060,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -3122,9 +3073,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -3185,7 +3136,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -3525,52 +3476,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -3579,15 +3532,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -3599,12 +3552,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3613,22 +3563,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -3669,17 +3615,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -10857,7 +10799,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1163 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "19.0.0-canary-495cb589", + version: "19.0.0-canary-78407dad", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10873,7 +10815,7 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1416 = { +var internals$jscomp$inline_1446 = { bundleType: devToolsConfig$jscomp$inline_1163.bundleType, version: devToolsConfig$jscomp$inline_1163.version, rendererPackageName: devToolsConfig$jscomp$inline_1163.rendererPackageName, @@ -10900,19 +10842,19 @@ var internals$jscomp$inline_1416 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-495cb589" + reconcilerVersion: "19.0.0-canary-78407dad" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1417 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1447 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1417.isDisabled && - hook$jscomp$inline_1417.supportsFiber + !hook$jscomp$inline_1447.isDisabled && + hook$jscomp$inline_1447.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1417.inject( - internals$jscomp$inline_1416 + (rendererID = hook$jscomp$inline_1447.inject( + internals$jscomp$inline_1446 )), - (injectedHook = hook$jscomp$inline_1417); + (injectedHook = hook$jscomp$inline_1447); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { 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 5bbaedc84c902..239f76d1f3d2e 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<> + * @generated SignedSource<> */ "use strict"; @@ -3087,55 +3087,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") 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://react.dev/link/refs-must-have-owner for more information." - ); - 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://react.dev/link/strict-mode-string-ref" - ); - var 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 = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -3231,12 +3182,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -3244,9 +3195,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -3307,7 +3258,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -3647,52 +3598,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -3701,15 +3654,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -3721,12 +3674,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3735,22 +3685,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -3791,17 +3737,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -11563,7 +11505,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1245 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "19.0.0-canary-e56bfcc6", + version: "19.0.0-canary-72ddc996", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11619,7 +11561,7 @@ var roots = new Map(), scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-e56bfcc6" + reconcilerVersion: "19.0.0-canary-72ddc996" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { computeComponentStackForErrorReporting: function (reactTag) {