image icon indicating copy to clipboard operation
image copied to clipboard

Issue with preview and fallback

Open LeComptoirDesPharmacies opened this issue 3 years ago • 2 comments

Hi,

We have got a problem with preview being unavailable when 'src' is wrong and 'fallback' is used. We found your example here but it does not seems to work : https://github.com/react-component/image/blob/d78487df5467a9ed00a9f7b51be33d1298e7e1b7/docs/examples/fallback.tsx

Here is a reproducer : https://codesandbox.io/s/polished-leaf-svmdt?file=/src/App.js:360-371

Thanks in advance for clarifications about misuse on our side or bug discovery. Yours faithfully, LCDP

LeComptoirDesPharmacies avatar Mar 22 '21 12:03 LeComptoirDesPharmacies

yep, if error src and provide a fallback, preview not work, because preview depend on src, fallback now only display when load src error

shaodahong avatar Mar 23 '21 02:03 shaodahong

O.K ! Do you think that it should stay like this or enhancement can be considered ?

If no enhancement considered, we will simulate fallback property on higher level by wrapping your component and replacing "src" value dynamically when "onError" callback is called. Do you see any contraindication to this ?

Yours faithfully, LCDP

LeComptoirDesPharmacies avatar Apr 02 '21 13:04 LeComptoirDesPharmacies