Commit 6828f62 1 parent 94638fd commit 6828f62 Copy full SHA for 6828f62
File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
'use client' ;
2
2
import { usePathname } from 'next/navigation' ;
3
- import React , { createRef , useEffect } from 'react' ;
3
+ import React , { useEffect , useRef } from 'react' ;
4
4
import { InnerScrollEvent } from '.' ;
5
5
import useClasses from '../use-classes' ;
6
6
import useScale , { withScale } from '../use-scale' ;
@@ -25,7 +25,7 @@ const InnerScrollComponent: React.FC<React.PropsWithChildren<InnerScrollProps>>
25
25
...props
26
26
} ) => {
27
27
const { UNIT , SCALE , CLASS_NAMES } = useScale ( ) ;
28
- const ref = createRef < HTMLDivElement > ( ) ;
28
+ const ref = useRef < HTMLDivElement > ( null ) ;
29
29
const pathName = usePathname ( ) ;
30
30
31
31
const onScrollHandler = ( ) => {
@@ -38,7 +38,7 @@ const InnerScrollComponent: React.FC<React.PropsWithChildren<InnerScrollProps>>
38
38
useEffect ( ( ) => {
39
39
if ( scrollUpOnRouteChange ) {
40
40
ref ?. current ?. scrollTo ( {
41
- top : 0 ,
41
+ top : ref . current . scrollTop ,
42
42
behavior : 'instant' ,
43
43
} ) ;
44
44
}
You can’t perform that action at this time.
0 commit comments