Skip to content

Commit a7c36de

Browse files
author
LB
authored
chore: remove scroll container (#29437)
* remove scroll container * update docs to remove deprecated stuff
1 parent 6365768 commit a7c36de

File tree

3 files changed

+1
-119
lines changed

3 files changed

+1
-119
lines changed

docs/docs/how-to/routing/scroll-restoration.md

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Scroll Restoration
44

55
Scroll restoration refers to the [`scrollRestoration`](https://developer.mozilla.org/en-US/docs/Web/API/History/scrollRestoration) property on the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) API. This property allows restoring a user's scroll position when navigating to a new page.
66

7-
Gatsby will handle scroll restoration for you in most cases. However, when you render containers that have their own scroll values, those scroll positions are typically lost between page transitions. To solve that, users can use the `useScrollRestoration` hook or the (deprecated) `ScrollContainer` component in their code to tell Gatsby about scroll containers that we should track and restore.
7+
Gatsby will handle scroll restoration for you in most cases. However, when you render containers that have their own scroll values, those scroll positions are typically lost between page transitions. To solve that, users can use the `useScrollRestoration` hook in their code to tell Gatsby about scroll containers that we should track and restore.
88

99
Here is an example of using the `useScrollRestoration` hook to render a list of countries in an overflow `ul` element.
1010

@@ -24,24 +24,3 @@ export default function PageComponent() {
2424
)
2525
}
2626
```
27-
28-
This is an example of using the (deprecated) `ScrollContainer` component with the same code.
29-
30-
```jsx
31-
import { ScrollContainer } from "gatsby-react-router-scroll"
32-
import countryList from "../utils/country-list"
33-
34-
export default class PageComponent extends React.Component {
35-
render() {
36-
return (
37-
<ScrollContainer key="page-component-ul-list">
38-
<ul style={{ height: 200, overflow: `auto` }}>
39-
{countryList.map(country => (
40-
<li>{country}</li>
41-
))}
42-
</ul>
43-
</ScrollContainer>
44-
)
45-
}
46-
}
47-
```
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
export { ScrollHandler as ScrollContext } from "./scroll-handler"
2-
export { ScrollContainer } from "./scroll-container"
32
export { useScrollRestoration } from "./use-scroll-restoration"

packages/gatsby-react-router-scroll/src/scroll-container.tsx

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)