Skip to content

Commit

Permalink
fix: renamed refUploadCtxProvider to apiRef
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Didenko committed Apr 29, 2024
1 parent 71de0ff commit 4440e68
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions packages/react-uploader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ import {FileUploaderRegular} from "@uploadcare/react-uploader";

## File Uploader API

For convenience, we provide the ability to access the File Uploader API using `refUploadCtxProvider`.
You can see what methods are available in `refUploadCtxProvider` in the [documentation][uc-docs-file-uploader-api].
For convenience, we provide the ability to access the File Uploader API using `apiRef`.
You can see what methods are available in `apiRef` in the [documentation][uc-docs-file-uploader-api].
It is important to note that we now pass all InstanceType from UploadCtxProvider.

```jsx
Expand All @@ -118,7 +118,7 @@ const Example = () => {
const uploaderRef = useRef < InstanceType < UploadCtxProvider > | null > (null);


<FileUploaderRegular refUploadCtxProvider={uploaderRef} pubkey="YOUR_PUBLIC_KEY"/>;
<FileUploaderRegular apiRef={uploaderRef} pubkey="YOUR_PUBLIC_KEY"/>;
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const CSS_SRC_INLINE = getStyleSource("inline");
export const FileUploaderInline: FC<TProps> = ({
ctxName,
className,
refUploadCtxProvider,
apiRef,
...props
}) => {
const CTX_NAME = useMemo(() => ctxName ?? LR.UID.generate(), [ctxName]);
Expand All @@ -36,7 +36,7 @@ export const FileUploaderInline: FC<TProps> = ({
<AdapterConfig userAgentIntegration={getUserAgentIntegration()} ctx-name={CTX_NAME} {...config} />
{/* @ts-ignore */}
<AdapterUploadCtxProvider
ref={refUploadCtxProvider}
ref={apiRef}
ctx-name={CTX_NAME}
{...eventHandlers}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const CSS_SRC_MINIMAL = getStyleSource("minimal");
export const FileUploaderMinimal: FC<TProps> = ({
ctxName,
className,
refUploadCtxProvider,
apiRef,
...props
}) => {
const CTX_NAME = useMemo(() => ctxName ?? LR.UID.generate(), [ctxName]);
Expand All @@ -37,7 +37,7 @@ export const FileUploaderMinimal: FC<TProps> = ({
<AdapterConfig userAgentIntegration={getUserAgentIntegration()} ctx-name={CTX_NAME} {...config} />
{/* @ts-ignore */}
<AdapterUploadCtxProvider
ref={refUploadCtxProvider}
ref={apiRef}
ctx-name={CTX_NAME}
{...eventHandlers}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const CSS_SRC_REGULAR = getStyleSource("regular");
export const FileUploaderRegular: FC<TProps> = ({
ctxName,
className,
refUploadCtxProvider,
apiRef,
...props
}) => {
const CTX_NAME = useMemo(() => ctxName ?? LR.UID.generate(), [ctxName]);
Expand All @@ -38,7 +38,7 @@ export const FileUploaderRegular: FC<TProps> = ({
<AdapterConfig userAgentIntegration={getUserAgentIntegration()} ctx-name={CTX_NAME} {...config} />
{/* @ts-ignore */}
<AdapterUploadCtxProvider
ref={refUploadCtxProvider}
ref={apiRef}
ctx-name={CTX_NAME}
{...eventHandlers}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-uploader/src/Uploader/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type TEventsSchema = {
};

type TRefUploadCtxProvider = {
refUploadCtxProvider?: Ref<InstanceType<UploadCtxProvider>>;
apiRef?: Ref<InstanceType<UploadCtxProvider>>;
};

type TPropsWithEvents = Partial<TEventsSchema>;
Expand Down

0 comments on commit 4440e68

Please sign in to comment.