Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passed RenderImage may not be a react class component, but typescript types indicate otherwise #195

Open
duesenfranz opened this issue Feb 9, 2021 · 0 comments

Comments

@duesenfranz
Copy link

duesenfranz commented Feb 9, 2021

When passing a class component as RenderImage, the error
Uncaught TypeError: renderComponent is not a function
gets thrown here:

return renderComponent({
left,
top,
key: thumb.key || thumb.src,
containerHeight,
index,
margin,
direction,
onClick: onClick ? handleClick : null,
photo,
});

An easy fix seems to be to call renderComponents using jsx syntax, like <renderComponent left=left [...] />. If this is for some reason not possible, the line

renderImage?: React.ComponentType<RenderImageProps<CustomPhotoProps>>

should be changed to
renderImage?: React.StatelessFunctionalComponent<RenderImageProps<CustomPhotoProps>>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant