File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -43,9 +43,10 @@ const Scrollama = props => {
4343 }
4444 } , [ ] ) ;
4545
46- const innerHeight = ( windowInnerHeight || window . innerHeight )
46+ const isBrowser = typeof window !== "undefined" ;
47+ const innerHeight = isBrowser ? ( windowInnerHeight || window . innerHeight ) : 0 ;
4748
48- const offsetValue = isOffsetDefinedInPixels
49+ const offsetValue = isOffsetDefinedInPixels
4950 ? ( + offset . replace ( 'px' , '' ) / innerHeight )
5051 : offset ;
5152
Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ const Step = props => {
2727 innerHeight,
2828 } = props ;
2929
30- const scrollTop = document . documentElement . scrollTop ;
30+ const isBrowser = typeof window !== "undefined" ;
31+ const scrollTop = isBrowser ? document . documentElement . scrollTop : 0 ;
3132 const direction = lastScrollTop < scrollTop ? 'down' : 'up' ;
3233
3334 const rootMargin = useRootMargin ( offset ) ;
@@ -58,7 +59,7 @@ const Step = props => {
5859 } ,
5960 [ inViewRef , scrollProgressRef ] ,
6061 ) ;
61-
62+
6263
6364 React . useEffect ( ( ) => {
6465 if ( isIntersecting ) {
You can’t perform that action at this time.
0 commit comments