@@ -269,7 +269,7 @@ index ce1fe00001c9e5aee6c6ea8bb2d4757d4586d002..ca6e596aa53327a097a388ffd545a4c6
269269 * Number of columns to render items in.
270270 * @default 1
271271diff --git a/react-native.js b/react-native.js
272- index b3c5a306b293f797a8b338adfca3060c0f6db22b..3c67a536d850d8c508336cf0f10c0c898ea67f12 100644
272+ index b3c5a306b293f797a8b338adfca3060c0f6db22b..d7f59b63cd4982dfc9c347732caa77e0974864df 100644
273273--- a/react-native.js
274274+++ b/react-native.js
275275@@ -717,6 +717,15 @@ function hasActiveInitialScroll(state) {
@@ -909,7 +909,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..3c67a536d850d8c508336cf0f10c0c89
909909 recycleItems,
910910 refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React2__namespace.cloneElement(refreshControlElement, {
911911diff --git a/react-native.mjs b/react-native.mjs
912- index 40e87cda8c9bc79a889e5542f29af429a24b24d4..c1b68df0f53d566c98a4820b39079396a09f1208 100644
912+ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..c2ca39bab6ea1ebaaed25190a01e8cf2e395ece9 100644
913913--- a/react-native.mjs
914914+++ b/react-native.mjs
915915@@ -696,6 +696,15 @@ function hasActiveInitialScroll(state) {
@@ -1619,7 +1619,7 @@ index 95465f2ab89ce41a10553f58af83618f7310e83c..d7cbe1cb43449cc29822b2646deabbdd
16191619 }
16201620 }
16211621diff --git a/react.js b/react.js
1622- index 914d2dafaafa001c9ab6791a0a0581659295e333..86dbd9a5c7345577e4a8a435041ecb68257ae9f1 100644
1622+ index 914d2dafaafa001c9ab6791a0a0581659295e333..199aae77b3620b7c4bb2ecd96b82978c0430059a 100644
16231623--- a/react.js
16241624+++ b/react.js
16251625@@ -4702,7 +4702,8 @@ function maybeUpdateAnchoredEndSpace(ctx) {
@@ -1655,7 +1655,39 @@ index 914d2dafaafa001c9ab6791a0a0581659295e333..86dbd9a5c7345577e4a8a435041ecb68
16551655 setContainerLayoutBaseline(element, rect);
16561656 measurements.push({
16571657 containerId,
1658- @@ -5651,6 +5659,18 @@ var ContainerSlot = typedMemo(function ContainerSlot2(props) {
1658+ @@ -4978,12 +4986,26 @@ var ContainerLayoutCoordinator = typedMemo(function ContainerLayoutCoordinatorCo
1659+ }) {
1660+ const ctx = useStateContext();
1661+ const [containerLayoutEpoch] = useArr$(["containerLayoutEpoch"]);
1662+ + const layoutPasses = React3__namespace.useRef(0);
1663+ React3__namespace.useLayoutEffect(() => {
1664+ - {
1665+ - const targetContainerIds = getContainerLayoutEffectScope(ctx);
1666+ - if (targetContainerIds !== void 0) {
1667+ - measureContainersInLayoutEffect(ctx, targetContainerIds);
1668+ - }
1669+ + const targetContainerIds = getContainerLayoutEffectScope(ctx);
1670+ + if (targetContainerIds === void 0) return;
1671+ + if (layoutPasses.current === 0) {
1672+ + queueMicrotask(() => { layoutPasses.current = 0; });
1673+ + }
1674+ + // Correcting large estimates can mount one row per commit. Bound the
1675+ + // synchronous chain below React's nested-update limit, then keep measuring
1676+ + // the latest pending rows on the next frame. Idle lists schedule no work.
1677+ + if (layoutPasses.current++ < 8) {
1678+ + measureContainersInLayoutEffect(ctx, targetContainerIds);
1679+ + } else {
1680+ + ctx.pendingContainerIds = targetContainerIds;
1681+ + ctx.state.scheduledWork.frame(() => {
1682+ + const pendingIds = getContainerLayoutEffectScope(ctx);
1683+ + if (pendingIds !== void 0) {
1684+ + measureContainersInLayoutEffect(ctx, pendingIds);
1685+ + }
1686+ + }, "containerLayout");
1687+ }
1688+ }, [ctx, containerLayoutEpoch]);
1689+ return children;
1690+ @@ -5651,6 +5673,18 @@ var ContainerSlot = typedMemo(function ContainerSlot2(props) {
16591691 });
16601692
16611693 // src/utils/reordering.ts
@@ -1674,7 +1706,7 @@ index 914d2dafaafa001c9ab6791a0a0581659295e333..86dbd9a5c7345577e4a8a435041ecb68
16741706 function sortDOMElements(container, indexByElement) {
16751707 const elements = Array.from(container.children);
16761708 if (elements.length <= 1) return elements;
1677- @@ -5690,9 +5710 ,9 @@ function sortDOMElements(container, indexByElement) {
1709+ @@ -5690,9 +5724 ,9 @@ function sortDOMElements(container, indexByElement) {
16781710 }
16791711 }
16801712 if (nextStableElement) {
@@ -1686,7 +1718,7 @@ index 914d2dafaafa001c9ab6791a0a0581659295e333..86dbd9a5c7345577e4a8a435041ecb68
16861718 }
16871719 }
16881720 }
1689- @@ -6446,8 +6466 ,8 @@ function ScrollAdjust() {
1721+ @@ -6446,8 +6480 ,8 @@ function ScrollAdjust() {
16901722 window.getComputedStyle(contentNode)[axis.paddingEndProp]
16911723 );
16921724 const temporaryPaddingEnd = `${(currentPaddingEnd || 0) + pad}px`;
@@ -1697,7 +1729,7 @@ index 914d2dafaafa001c9ab6791a0a0581659295e333..86dbd9a5c7345577e4a8a435041ecb68
16971729 scrollBy();
16981730 if (resetPaddingRafRef.current !== void 0) {
16991731diff --git a/react.mjs b/react.mjs
1700- index 95465f2ab89ce41a10553f58af83618f7310e83c..cff49dc5c769cab264b8527a268851295c44aa33 100644
1732+ index 95465f2ab89ce41a10553f58af83618f7310e83c..a123bd3e9df510100d44dfae1f59b87e2e456cfc 100644
17011733--- a/react.mjs
17021734+++ b/react.mjs
17031735@@ -4681,7 +4681,8 @@ function maybeUpdateAnchoredEndSpace(ctx) {
@@ -1733,7 +1765,39 @@ index 95465f2ab89ce41a10553f58af83618f7310e83c..cff49dc5c769cab264b8527a26885129
17331765 setContainerLayoutBaseline(element, rect);
17341766 measurements.push({
17351767 containerId,
1736- @@ -5630,6 +5638,18 @@ var ContainerSlot = typedMemo(function ContainerSlot2(props) {
1768+ @@ -4957,12 +4965,26 @@ var ContainerLayoutCoordinator = typedMemo(function ContainerLayoutCoordinatorCo
1769+ }) {
1770+ const ctx = useStateContext();
1771+ const [containerLayoutEpoch] = useArr$(["containerLayoutEpoch"]);
1772+ + const layoutPasses = React3.useRef(0);
1773+ React3.useLayoutEffect(() => {
1774+ - {
1775+ - const targetContainerIds = getContainerLayoutEffectScope(ctx);
1776+ - if (targetContainerIds !== void 0) {
1777+ - measureContainersInLayoutEffect(ctx, targetContainerIds);
1778+ - }
1779+ + const targetContainerIds = getContainerLayoutEffectScope(ctx);
1780+ + if (targetContainerIds === void 0) return;
1781+ + if (layoutPasses.current === 0) {
1782+ + queueMicrotask(() => { layoutPasses.current = 0; });
1783+ + }
1784+ + // Correcting large estimates can mount one row per commit. Bound the
1785+ + // synchronous chain below React's nested-update limit, then keep measuring
1786+ + // the latest pending rows on the next frame. Idle lists schedule no work.
1787+ + if (layoutPasses.current++ < 8) {
1788+ + measureContainersInLayoutEffect(ctx, targetContainerIds);
1789+ + } else {
1790+ + ctx.pendingContainerIds = targetContainerIds;
1791+ + ctx.state.scheduledWork.frame(() => {
1792+ + const pendingIds = getContainerLayoutEffectScope(ctx);
1793+ + if (pendingIds !== void 0) {
1794+ + measureContainersInLayoutEffect(ctx, pendingIds);
1795+ + }
1796+ + }, "containerLayout");
1797+ }
1798+ }, [ctx, containerLayoutEpoch]);
1799+ return children;
1800+ @@ -5630,6 +5652,18 @@ var ContainerSlot = typedMemo(function ContainerSlot2(props) {
17371801 });
17381802
17391803 // src/utils/reordering.ts
@@ -1752,7 +1816,7 @@ index 95465f2ab89ce41a10553f58af83618f7310e83c..cff49dc5c769cab264b8527a26885129
17521816 function sortDOMElements(container, indexByElement) {
17531817 const elements = Array.from(container.children);
17541818 if (elements.length <= 1) return elements;
1755- @@ -5669,9 +5689 ,9 @@ function sortDOMElements(container, indexByElement) {
1819+ @@ -5669,9 +5703 ,9 @@ function sortDOMElements(container, indexByElement) {
17561820 }
17571821 }
17581822 if (nextStableElement) {
@@ -1764,7 +1828,7 @@ index 95465f2ab89ce41a10553f58af83618f7310e83c..cff49dc5c769cab264b8527a26885129
17641828 }
17651829 }
17661830 }
1767- @@ -6425,8 +6445 ,8 @@ function ScrollAdjust() {
1831+ @@ -6425,8 +6459 ,8 @@ function ScrollAdjust() {
17681832 window.getComputedStyle(contentNode)[axis.paddingEndProp]
17691833 );
17701834 const temporaryPaddingEnd = `${(currentPaddingEnd || 0) + pad}px`;
0 commit comments