File tree Expand file tree Collapse file tree 10 files changed +1185
-739
lines changed
reverse-horizontal-element-scroll
reverse-vertical-element-scroll
react-infinite-scroll-hook Expand file tree Collapse file tree 10 files changed +1185
-739
lines changed Original file line number Diff line number Diff line change 22/// <reference types="next/image-types/global" />
33
44// NOTE: This file should not be edited
5- // see https://nextjs.org/docs/basic-features /typescript for more information.
5+ // see https://nextjs.org/docs/app/api-reference/config /typescript for more information.
Original file line number Diff line number Diff line change 1111 "typecheck" : " tsc"
1212 },
1313 "dependencies" : {
14- "next" : " 14.2.5 " ,
15- "react" : " ^18.3.1 " ,
16- "react-dom" : " ^18.3.1 " ,
14+ "next" : " 15.3.1 " ,
15+ "react" : " ^19.1.0 " ,
16+ "react-dom" : " ^19.1.0 " ,
1717 "react-infinite-scroll-hook" : " *"
1818 },
1919 "devDependencies" : {
2020 "@repo/eslint-config" : " *" ,
2121 "@repo/lint-staged-config" : " *" ,
2222 "@repo/typescript-config" : " *" ,
23- "@types/node" : " ^22.4.0 " ,
24- "@types/react" : " ^18.3.3 " ,
25- "@types/react-dom" : " ^18.3.0 " ,
26- "autoprefixer" : " ^10.4.20 " ,
23+ "@types/node" : " ^22.15.3 " ,
24+ "@types/react" : " ^19.1.2 " ,
25+ "@types/react-dom" : " ^19.1.3 " ,
26+ "autoprefixer" : " ^10.4.21 " ,
2727 "eslint" : " ^8.57.0" ,
2828 "eslint-config-next" : " 14.2.5" ,
29- "postcss" : " ^8.4.41 " ,
29+ "postcss" : " ^8.5.3 " ,
3030 "tailwindcss" : " ^3.4.10" ,
31- "typescript" : " ^5.5.4 "
31+ "typescript" : " ^5.8.3 "
3232 }
3333}
Original file line number Diff line number Diff line change @@ -17,14 +17,14 @@ export default function ReverseHorizontalElementScrollPage() {
1717 } ) ;
1818
1919 const scrollableRootRef = useRef < React . ComponentRef < 'div' > | null > ( null ) ;
20- const lastScrollDistanceToRightRef = useRef < number > ( ) ;
20+ const lastScrollDistanceToRightRef = useRef < number > ( 0 ) ;
2121
2222 const reversedItems = useMemo ( ( ) => [ ...items ] . reverse ( ) , [ items ] ) ;
2323
2424 // We keep the scroll position when new items are added etc.
2525 useLayoutEffect ( ( ) => {
2626 const scrollableRoot = scrollableRootRef . current ;
27- const lastScrollDistanceToRight = lastScrollDistanceToRightRef . current ?? 0 ;
27+ const lastScrollDistanceToRight = lastScrollDistanceToRightRef . current ;
2828 if ( scrollableRoot ) {
2929 scrollableRoot . scrollLeft =
3030 scrollableRoot . scrollWidth - lastScrollDistanceToRight ;
Original file line number Diff line number Diff line change @@ -17,15 +17,14 @@ export default function ReverseVerticalElementScrollPage() {
1717 } ) ;
1818
1919 const scrollableRootRef = useRef < React . ComponentRef < 'div' > | null > ( null ) ;
20- const lastScrollDistanceToBottomRef = useRef < number > ( ) ;
20+ const lastScrollDistanceToBottomRef = useRef < number > ( 0 ) ;
2121
2222 const reversedItems = useMemo ( ( ) => [ ...items ] . reverse ( ) , [ items ] ) ;
2323
2424 // We keep the scroll position when new items are added etc.
2525 useLayoutEffect ( ( ) => {
2626 const scrollableRoot = scrollableRootRef . current ;
27- const lastScrollDistanceToBottom =
28- lastScrollDistanceToBottomRef . current ?? 0 ;
27+ const lastScrollDistanceToBottom = lastScrollDistanceToBottomRef . current ;
2928 if ( scrollableRoot ) {
3029 scrollableRoot . scrollTop =
3130 scrollableRoot . scrollHeight - lastScrollDistanceToBottom ;
Original file line number Diff line number Diff line change @@ -16,14 +16,13 @@ export default function ReverseWindowScrollPage() {
1616 disabled : Boolean ( error ) ,
1717 } ) ;
1818
19- const lastScrollDistanceToBottomRef = useRef < number > ( ) ;
19+ const lastScrollDistanceToBottomRef = useRef < number > ( 0 ) ;
2020
2121 const reversedItems = useMemo ( ( ) => [ ...items ] . reverse ( ) , [ items ] ) ;
2222
2323 // We keep the scroll position when new items are added etc.
2424 useLayoutEffect ( ( ) => {
25- const lastScrollDistanceToBottom =
26- lastScrollDistanceToBottomRef . current ?? 0 ;
25+ const lastScrollDistanceToBottom = lastScrollDistanceToBottomRef . current ;
2726
2827 document . documentElement . scrollTop =
2928 document . body . scrollHeight - lastScrollDistanceToBottom ;
You can’t perform that action at this time.
0 commit comments