react-image-lightbox icon indicating copy to clipboard operation
react-image-lightbox copied to clipboard

Loading circle/Spinner customization

Open ray-su opened this issue 6 years ago • 9 comments

Hello! Thank you for this great package. Is it possible to add Loading circle/Spinner customization to it?

ray-su avatar Sep 02 '17 22:09 ray-su

@ray-su did you can add a custom image?

dmoli avatar Jan 19 '18 18:01 dmoli

@kaizenberg I didn't. If I remember correctly, the loading spinner is not a looping gif. it's made using CSS transform.

ray-su avatar Jan 19 '18 20:01 ray-su

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 />}
/>

3nvi avatar Jan 27 '18 17:01 3nvi

This is a good candidate for a pull request.

fritz-c avatar Jan 28 '18 23:01 fritz-c

Hi guys, I have pr for this :) #125

mik639 avatar Jun 27 '18 19:06 mik639

@wuweiweiwu @fritz-c Any update on this? Can you tell us what to do/expect?

borisrorsvort avatar Jul 17 '19 07:07 borisrorsvort

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.

SeinopSys avatar Sep 05 '21 00:09 SeinopSys

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: Screen Shot 2021-09-17 at 9 45 48 AM

ghost avatar Sep 17 '21 13:09 ghost

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.

SeinopSys avatar Sep 17 '21 17:09 SeinopSys