Skip to content

Commit

Permalink
fix: add path in ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jingsong Xiong committed Apr 28, 2022
1 parent 0f55ac5 commit d164104
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 3 additions & 5 deletions typings/react-dropzone.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as React from "react";
import { FileWithPath } from "file-selector";

export {FileWithPath};

export { FileWithPath } from "file-selector";
export default function Dropzone(
props: DropzoneProps & React.RefAttributes<DropzoneRef>
): JSX.Element;
Expand Down Expand Up @@ -68,8 +66,8 @@ export type DropzoneState = DropzoneRef & {
isDragAccept: boolean;
isDragReject: boolean;
isFileDialogActive: boolean;
draggedFiles: FileWithPath[];
acceptedFiles: FileWithPath[];
draggedFiles: (File & { path?: string })[];
acceptedFiles: (File & { path?: string })[];
fileRejections: FileRejection[];
rootRef: React.RefObject<HTMLElement>;
inputRef: React.RefObject<HTMLInputElement>;
Expand Down
12 changes: 10 additions & 2 deletions typings/tests/hook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import React from "react";
import { useDropzone, DropzoneProps } from "../../";

export const Dropzone = ({ children, ...opts }: DropzoneProps) => {
const state = useDropzone(opts);
return <>{children(state)}</>;
const { ...state } = useDropzone(opts);
return children(state);
};

<Dropzone>
{({ getRootProps, getInputProps }) => (
<div {...getRootProps()}>
<input {...getInputProps()} />
</div>
)}
</Dropzone>;

0 comments on commit d164104

Please sign in to comment.