File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ import ScrollContext from "../context/ScrollContext";
3
3
import { Directions } from "../types" ;
4
4
import validateScrollValue from "../utils/validateScrollValue" ;
5
5
6
+ /**
7
+ * @description This hooks calculates the direction of your scroll
8
+ * @returns direction: "UP" or "DOWN"
9
+ */
6
10
const useDirection = ( ) => {
7
11
const scrollState = useContext ( ScrollContext ) ;
8
12
const [ direction , setDirection ] = useState ( Directions . down ) ;
Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ import React, {
8
8
import ScrollContext from "../context/ScrollContext" ;
9
9
import validateScrollValue from "../utils/validateScrollValue" ;
10
10
11
+ /**
12
+ * @description This hooks returns the proximity of the viewport from the component.
13
+ * @param ref A reference to the HTMLElement
14
+ * @returns A float value that represents the proximity to the component. The closer to 1 the closer is the middle of the screen from the component.
15
+ */
11
16
const useProximity = ( ref : RefObject < any > ) => {
12
17
const scrollState = useContext ( ScrollContext ) ;
13
18
You can’t perform that action at this time.
0 commit comments