Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ export default function ScrollIntoViewCase() {
const scrollContainerRef = useRef(null);

const scrollVertical = () => {
fragmentRef.current.experimental_scrollIntoView(alignToTop);
fragmentRef.current.scrollIntoView(alignToTop);
};

const scrollVerticalNoChildren = () => {
noChildRef.current.experimental_scrollIntoView(alignToTop);
noChildRef.current.scrollIntoView(alignToTop);
};

useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -3341,13 +3341,13 @@ function validateDocumentPositionWithFiberTree(

if (enableFragmentRefsScrollIntoView) {
// $FlowFixMe[prop-missing]
FragmentInstance.prototype.experimental_scrollIntoView = function (
FragmentInstance.prototype.scrollIntoView = function (
this: FragmentInstanceType,
alignToTop?: boolean,
): void {
if (typeof alignToTop === 'object') {
throw new Error(
'FragmentInstance.experimental_scrollIntoView() does not support ' +
'FragmentInstance.scrollIntoView() does not support ' +
'scrollIntoViewOptions. Use the alignToTop boolean instead.',
);
}
Expand Down
24 changes: 12 additions & 12 deletions packages/react-dom/src/__tests__/ReactDOMFragmentRefs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1960,9 +1960,9 @@ describe('FragmentRefs', () => {
});

expect(() => {
fragmentRef.current.experimental_scrollIntoView({block: 'start'});
fragmentRef.current.scrollIntoView({block: 'start'});
}).toThrowError(
'FragmentInstance.experimental_scrollIntoView() does not support ' +
'FragmentInstance.scrollIntoView() does not support ' +
'scrollIntoViewOptions. Use the alignToTop boolean instead.',
);
});
Expand Down Expand Up @@ -1996,11 +1996,11 @@ describe('FragmentRefs', () => {
});

// Default call
fragmentRef.current.experimental_scrollIntoView();
fragmentRef.current.scrollIntoView();
expectLast(logs, 'childA');
logs = [];
// alignToTop=true
fragmentRef.current.experimental_scrollIntoView(true);
fragmentRef.current.scrollIntoView(true);
expectLast(logs, 'childA');
});

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

fragmentRef.current.experimental_scrollIntoView(false);
fragmentRef.current.scrollIntoView(false);
expectLast(logs, 'childB');
});

Expand Down Expand Up @@ -2068,7 +2068,7 @@ describe('FragmentRefs', () => {
});

// Default call
fragmentRef.current.experimental_scrollIntoView();
fragmentRef.current.scrollIntoView();
expectLast(logs, 'childA');
});

Expand Down Expand Up @@ -2157,7 +2157,7 @@ describe('FragmentRefs', () => {
});

// Default call
fragmentRef.current.experimental_scrollIntoView();
fragmentRef.current.scrollIntoView();
expectLast(logs, 'header');

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

// // alignToTop=false
fragmentRef.current.experimental_scrollIntoView(false);
fragmentRef.current.scrollIntoView(false);
expectLast(logs, 'C');
});
});
Expand Down Expand Up @@ -2195,14 +2195,14 @@ describe('FragmentRefs', () => {
siblingBRef.current.scrollIntoView = jest.fn();

// Default call
fragmentRef.current.experimental_scrollIntoView();
fragmentRef.current.scrollIntoView();
expect(siblingARef.current.scrollIntoView).toHaveBeenCalledTimes(0);
expect(siblingBRef.current.scrollIntoView).toHaveBeenCalledTimes(1);

siblingBRef.current.scrollIntoView.mockClear();

// alignToTop=true
fragmentRef.current.experimental_scrollIntoView(true);
fragmentRef.current.scrollIntoView(true);
expect(siblingARef.current.scrollIntoView).toHaveBeenCalledTimes(0);
expect(siblingBRef.current.scrollIntoView).toHaveBeenCalledTimes(1);
});
Expand Down Expand Up @@ -2239,7 +2239,7 @@ describe('FragmentRefs', () => {
siblingBRef.current.scrollIntoView = jest.fn();

// alignToTop=false
fragmentRef.current.experimental_scrollIntoView(false);
fragmentRef.current.scrollIntoView(false);
expect(siblingARef.current.scrollIntoView).toHaveBeenCalledTimes(1);
expect(siblingBRef.current.scrollIntoView).toHaveBeenCalledTimes(0);
});
Expand All @@ -2260,7 +2260,7 @@ describe('FragmentRefs', () => {
});

parentRef.current.scrollIntoView = jest.fn();
fragmentRef.current.experimental_scrollIntoView();
fragmentRef.current.scrollIntoView();
expect(parentRef.current.scrollIntoView).toHaveBeenCalledTimes(1);
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ export const transitionLaneExpirationMs = 5000;
*/
export const enableInfiniteRenderLoopDetection: boolean = false;

export const enableFragmentRefs = __EXPERIMENTAL__;
export const enableFragmentRefsScrollIntoView = __EXPERIMENTAL__;
export const enableFragmentRefs: boolean = true;
export const enableFragmentRefsScrollIntoView: boolean = true;

// -----------------------------------------------------------------------------
// Ready for next major.
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/forks/ReactFeatureFlags.native-oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const enableHydrationChangeEvent: boolean = false;
export const enableDefaultTransitionIndicator: boolean = false;
export const ownerStackLimit = 1e4;

export const enableFragmentRefs: boolean = false;
export const enableFragmentRefs: boolean = true;
export const enableFragmentRefsScrollIntoView: boolean = false;

// Profiling Only
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/forks/ReactFeatureFlags.test-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export const enableHydrationChangeEvent: boolean = false;
export const enableDefaultTransitionIndicator: boolean = false;
export const ownerStackLimit = 1e4;

export const enableFragmentRefs: boolean = false;
export const enableFragmentRefsScrollIntoView: boolean = false;
export const enableFragmentRefs: boolean = true;
export const enableFragmentRefsScrollIntoView: boolean = true;

// TODO: This must be in sync with the main ReactFeatureFlags file because
// the Test Renderer's value must be the same as the one used by the
Expand Down
2 changes: 1 addition & 1 deletion scripts/error-codes/codes.json
Original file line number Diff line number Diff line change
Expand Up @@ -551,5 +551,5 @@
"563": "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources.",
"564": "Unknown command. The debugChannel was not wired up properly.",
"565": "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React.",
"566": "FragmentInstance.experimental_scrollIntoView() does not support scrollIntoViewOptions. Use the alignToTop boolean instead."
"566": "FragmentInstance.scrollIntoView() does not support scrollIntoViewOptions. Use the alignToTop boolean instead."
}
Loading