Skip to content

Commit ab0cf48

Browse files
committed
experimental_scrollIntoView -> scrollIntoView
1 parent 487c366 commit ab0cf48

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

fixtures/dom/src/components/fixtures/fragment-refs/ScrollIntoViewCase.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ export default function ScrollIntoViewCase() {
5555
const scrollContainerRef = useRef(null);
5656

5757
const scrollVertical = () => {
58-
fragmentRef.current.experimental_scrollIntoView(alignToTop);
58+
fragmentRef.current.scrollIntoView(alignToTop);
5959
};
6060

6161
const scrollVerticalNoChildren = () => {
62-
noChildRef.current.experimental_scrollIntoView(alignToTop);
62+
noChildRef.current.scrollIntoView(alignToTop);
6363
};
6464

6565
useEffect(() => {

packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3341,13 +3341,13 @@ function validateDocumentPositionWithFiberTree(
33413341

33423342
if (enableFragmentRefsScrollIntoView) {
33433343
// $FlowFixMe[prop-missing]
3344-
FragmentInstance.prototype.experimental_scrollIntoView = function (
3344+
FragmentInstance.prototype.scrollIntoView = function (
33453345
this: FragmentInstanceType,
33463346
alignToTop?: boolean,
33473347
): void {
33483348
if (typeof alignToTop === 'object') {
33493349
throw new Error(
3350-
'FragmentInstance.experimental_scrollIntoView() does not support ' +
3350+
'FragmentInstance.scrollIntoView() does not support ' +
33513351
'scrollIntoViewOptions. Use the alignToTop boolean instead.',
33523352
);
33533353
}

packages/react-dom/src/__tests__/ReactDOMFragmentRefs-test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,9 +1960,9 @@ describe('FragmentRefs', () => {
19601960
});
19611961

19621962
expect(() => {
1963-
fragmentRef.current.experimental_scrollIntoView({block: 'start'});
1963+
fragmentRef.current.scrollIntoView({block: 'start'});
19641964
}).toThrowError(
1965-
'FragmentInstance.experimental_scrollIntoView() does not support ' +
1965+
'FragmentInstance.scrollIntoView() does not support ' +
19661966
'scrollIntoViewOptions. Use the alignToTop boolean instead.',
19671967
);
19681968
});
@@ -1996,11 +1996,11 @@ describe('FragmentRefs', () => {
19961996
});
19971997

19981998
// Default call
1999-
fragmentRef.current.experimental_scrollIntoView();
1999+
fragmentRef.current.scrollIntoView();
20002000
expectLast(logs, 'childA');
20012001
logs = [];
20022002
// alignToTop=true
2003-
fragmentRef.current.experimental_scrollIntoView(true);
2003+
fragmentRef.current.scrollIntoView(true);
20042004
expectLast(logs, 'childA');
20052005
});
20062006

@@ -2027,7 +2027,7 @@ describe('FragmentRefs', () => {
20272027
logs.push('childB');
20282028
});
20292029

2030-
fragmentRef.current.experimental_scrollIntoView(false);
2030+
fragmentRef.current.scrollIntoView(false);
20312031
expectLast(logs, 'childB');
20322032
});
20332033

@@ -2068,7 +2068,7 @@ describe('FragmentRefs', () => {
20682068
});
20692069

20702070
// Default call
2071-
fragmentRef.current.experimental_scrollIntoView();
2071+
fragmentRef.current.scrollIntoView();
20722072
expectLast(logs, 'childA');
20732073
});
20742074

@@ -2157,7 +2157,7 @@ describe('FragmentRefs', () => {
21572157
});
21582158

21592159
// Default call
2160-
fragmentRef.current.experimental_scrollIntoView();
2160+
fragmentRef.current.scrollIntoView();
21612161
expectLast(logs, 'header');
21622162

21632163
childARef.current.scrollIntoView.mockClear();
@@ -2167,7 +2167,7 @@ describe('FragmentRefs', () => {
21672167
logs = [];
21682168

21692169
// // alignToTop=false
2170-
fragmentRef.current.experimental_scrollIntoView(false);
2170+
fragmentRef.current.scrollIntoView(false);
21712171
expectLast(logs, 'C');
21722172
});
21732173
});
@@ -2195,14 +2195,14 @@ describe('FragmentRefs', () => {
21952195
siblingBRef.current.scrollIntoView = jest.fn();
21962196

21972197
// Default call
2198-
fragmentRef.current.experimental_scrollIntoView();
2198+
fragmentRef.current.scrollIntoView();
21992199
expect(siblingARef.current.scrollIntoView).toHaveBeenCalledTimes(0);
22002200
expect(siblingBRef.current.scrollIntoView).toHaveBeenCalledTimes(1);
22012201

22022202
siblingBRef.current.scrollIntoView.mockClear();
22032203

22042204
// alignToTop=true
2205-
fragmentRef.current.experimental_scrollIntoView(true);
2205+
fragmentRef.current.scrollIntoView(true);
22062206
expect(siblingARef.current.scrollIntoView).toHaveBeenCalledTimes(0);
22072207
expect(siblingBRef.current.scrollIntoView).toHaveBeenCalledTimes(1);
22082208
});
@@ -2239,7 +2239,7 @@ describe('FragmentRefs', () => {
22392239
siblingBRef.current.scrollIntoView = jest.fn();
22402240

22412241
// alignToTop=false
2242-
fragmentRef.current.experimental_scrollIntoView(false);
2242+
fragmentRef.current.scrollIntoView(false);
22432243
expect(siblingARef.current.scrollIntoView).toHaveBeenCalledTimes(1);
22442244
expect(siblingBRef.current.scrollIntoView).toHaveBeenCalledTimes(0);
22452245
});
@@ -2260,7 +2260,7 @@ describe('FragmentRefs', () => {
22602260
});
22612261

22622262
parentRef.current.scrollIntoView = jest.fn();
2263-
fragmentRef.current.experimental_scrollIntoView();
2263+
fragmentRef.current.scrollIntoView();
22642264
expect(parentRef.current.scrollIntoView).toHaveBeenCalledTimes(1);
22652265
});
22662266
});

scripts/error-codes/codes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,5 +551,5 @@
551551
"563": "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources.",
552552
"564": "Unknown command. The debugChannel was not wired up properly.",
553553
"565": "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React.",
554-
"566": "FragmentInstance.experimental_scrollIntoView() does not support scrollIntoViewOptions. Use the alignToTop boolean instead."
554+
"566": "FragmentInstance.scrollIntoView() does not support scrollIntoViewOptions. Use the alignToTop boolean instead."
555555
}

0 commit comments

Comments
 (0)