-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
🔦 Type: FeatureNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
When using the Image component, one would want to have two different images for the loading state as well as showing a fallback image when an error is encountered.
ATM, there is only one property called fallbackSrc that handles both states and displays one image, so there is no distinction between the loading and the error states.
Describe the solution you'd like
Please, make it possible to display another image on the Error state by adding a new property and modifying the use-image.ts file to handle such case.
Describe alternatives you've considered
Wrap the existing Image component and on the onError handler, set the fallbackSrc to point to another source like:
const [fallbackSrc, setFallbackSrc] = useState('');
<Image
fallbackSrc={fallbackSrc}
onError={() => {
setFallbackSrc('/assets/another-img');
}}
...
/>
Screenshots or Videos
No response
kaizerpwn and gekoke
Metadata
Metadata
Assignees
Labels
🔦 Type: FeatureNew feature or requestNew feature or request