Skip to content

Commit

Permalink
Add typescript typings
Browse files Browse the repository at this point in the history
  • Loading branch information
perrin4869 committed Dec 24, 2020
1 parent 33b5402 commit ed59bd4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
"url": "git+https://github.com/dotcore64/react-stay-scrolled.git"
},
"files": [
"dist"
"dist",
"types"
],
"types": "types/index.d.ts",
"keywords": [
"react-hooks",
"scroll"
Expand Down
19 changes: 19 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as React from "react";

export interface UseStayScrolled {
scroll: (position: number) => void;
stayScrolled: () => void;
scrollBottom: () => void;
isScrolled: () => boolean;
}

export interface UseStayScrolledOptions {
initialScroll: number | null;
inaccuracy: number;
runScroll?: (offset: number) => void;
}

export default function useStayScrolled(
domRef: React.RefObject<HTMLElement>,
options: UseStayScrolledOptions,
): UseStayScrolled;

0 comments on commit ed59bd4

Please sign in to comment.