You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Avatar component should support passing all available image props to the <img> tag to help support the referrerPolicy. See this stackoverflow thread for an error with google profile pics.
Proposal
The Avatar will be updated to have two new props: referrerPolicy and imgProps.
So any other props (or ref) can be passed as well:
constimgRef=useRef();return(<Avatarsrc="https://some.domain/path/to/img.png"imgProps={{ref: imgRef,style: {}className: 'custom',referrerPolicy: 'origin-when-cross-origin',// other props}}/>);
Note: any imgProps will be merged with the default implementation and imgProps will take precedence over the "root level" img, src, and referrerPolicy.
Workaround
The current workaround is to just manually provide the <img> as a child instead:
mlaursen
changed the title
[Avatar] Add a new imgProps prop to support
[Avatar] Add a new imgProps prop to support reffererPolicy behavior
Aug 4, 2020
mlaursen
changed the title
[Avatar] Add a new imgProps prop to support reffererPolicy behavior
[Avatar] Add support to pass additional props to the img element
Aug 4, 2020
mlaursen
changed the title
[Avatar] Add support to pass additional props to the img element
Add support to pass additional props to the Avatar's img element
Aug 6, 2020
Description
The
Avatar
component should support passing all available image props to the<img>
tag to help support thereferrerPolicy
. See this stackoverflow thread for an error with google profile pics.Proposal
The Avatar will be updated to have two new props:
referrerPolicy
andimgProps
.Examples with new props:
So any other props (or
ref
) can be passed as well:Note: any
imgProps
will be merged with the default implementation andimgProps
will take precedence over the "root level"img
,src
, andreferrerPolicy
.Workaround
The current workaround is to just manually provide the
<img>
as a child instead:The text was updated successfully, but these errors were encountered: