File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,15 @@ export function Parallax(props: PropsWithChildren<ParallaxProps>) {
19
19
) ;
20
20
}
21
21
22
+ export const Component = ( ) => {
23
+ const { ref } = useParallax < HTMLDivElement > ( { translateY : [ 100 , - 100 ] } ) ;
24
+ return (
25
+ < div ref = { ref } >
26
+ < div />
27
+ </ div >
28
+ ) ;
29
+ } ;
30
+
22
31
Parallax . defaultProps = {
23
32
disabled : false ,
24
33
innerTag : 'div' ,
Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ import { ParallaxProps } from '../types';
5
5
import { removeUndefinedObjectKeys } from '../utils/removeUndefinedObjectKeys' ;
6
6
import { useController } from './useController' ;
7
7
8
- export function useParallax ( props : ParallaxProps ) {
8
+ export function useParallax < T extends HTMLElement > ( props : ParallaxProps ) {
9
9
const controller = useController ( ) ;
10
- const ref = useRef < HTMLElement > ( ) ;
10
+ const ref = useRef < T > ( null ) ;
11
11
12
12
useVerifyController ( controller ) ;
13
13
You can’t perform that action at this time.
0 commit comments