react-image-lightbox
react-image-lightbox copied to clipboard
Loading circle/Spinner customization
Hello! Thank you for this great package. Is it possible to add Loading circle/Spinner customization to it?
@ray-su did you can add a custom image?
@kaizenberg I didn't. If I remember correctly, the loading spinner is not a looping gif. it's made using CSS transform.
Any progress on that? From my perspective i'd love to be able to provide a react element as a custom loader. Like so:
<Lightbox
{...otherProps}
spinner={<MyCustomLoader />}
/>
This is a good candidate for a pull request.
Hi guys, I have pr for this :) #125
@wuweiweiwu @fritz-c Any update on this? Can you tell us what to do/expect?
Seems like this was implemented in #385 but the TypeScript type definitions weren't updated, so attempting to use the loader
property results in a type error.
Hello @SeinopSys,
Can you explain a bit more the issue? When I try to implement a custom loader component, by using the loader={<ComponentName/>}, I get no error at all. <Lightbox... loader={<Test/>}/>
With my test component being:
const Test = () => { return ( <div style={{...}}>Loading...</div> ); }
Result I get:
That's not TypeScript though. I created a CodeSandbox link which shows the issue: https://codesandbox.io/s/react-image-lightbox-typescript-error-cn3hw?file=/src/LightboxExample.tsx
The loader
prop is not recognized by TypeScript due to that property missing from the interface inside index.d.ts
in the root of the project.