Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#69366 [react-lazy-load-image-component] fi…
Browse files Browse the repository at this point in the history
…x onLoad props by @yoonminsang
  • Loading branch information
yoonminsang authored Apr 16, 2024
1 parent 9c5aeea commit 69af757
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions types/react-lazy-load-image-component/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { ComponentType, CSSProperties, FunctionComponent, ImgHTMLAttributes, ReactElement, ReactNode } from "react";
import {
ComponentType,
CSSProperties,
FunctionComponent,
ImgHTMLAttributes,
ReactElement,
ReactEventHandler,
ReactNode,
} from "react";

export type DelayMethod = "debounce" | "throttle";
export type Effect = "blur" | "black-and-white" | "opacity";
Expand All @@ -12,7 +20,7 @@ export interface CommonProps {
/** @deprecated Use onLoad instead. This prop is only for backward compatibility. */
afterLoad?: (() => any) | undefined;
/** Function called when the image has been loaded. This is the same function as the onLoad of an <img> which contains an event object. */
onLoad?: (() => any) | undefined;
onLoad?: ReactEventHandler<HTMLImageElement>;
/** Function called right before the placeholder is replaced with the image element. */
beforeLoad?: (() => any) | undefined;
/* Method from lodash to use to delay the scroll/resize events. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ImageWithCallbacks = () => (
threshold={200}
beforeLoad={() => {}}
afterLoad={() => {}} // deprecated
onLoad={() => {}}
onLoad={e => {}}
placeholder={<span />}
wrapperProps={{
style: {
Expand Down

0 comments on commit 69af757

Please sign in to comment.