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>) {
1919 ) ;
2020}
2121
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+
2231Parallax . defaultProps = {
2332 disabled : false ,
2433 innerTag : 'div' ,
Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ import { ParallaxProps } from '../types';
55import { removeUndefinedObjectKeys } from '../utils/removeUndefinedObjectKeys' ;
66import { useController } from './useController' ;
77
8- export function useParallax ( props : ParallaxProps ) {
8+ export function useParallax < T extends HTMLElement > ( props : ParallaxProps ) {
99 const controller = useController ( ) ;
10- const ref = useRef < HTMLElement > ( ) ;
10+ const ref = useRef < T > ( null ) ;
1111
1212 useVerifyController ( controller ) ;
1313
You can’t perform that action at this time.
0 commit comments