Skip to content

Commit

Permalink
if height or width been set ignore 100% width or height
Browse files Browse the repository at this point in the history
  • Loading branch information
bluebill1049 committed Feb 9, 2019
1 parent 8911726 commit fe1926c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/simpleImg.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export class SimpleImg extends React.PureComponent<Props, State> {
...(height ? { height: wrapperStyle.height || height } : null),
...(width ? { width: wrapperStyle.width || width } : null),
};
const isHeightOrWidthSet = height || width;
return (
<span
Expand All @@ -197,8 +198,8 @@ export class SimpleImg extends React.PureComponent<Props, State> {
data-srcset={srcSet}
style={{
...(!isValidImgSrc && !loaded && !isSrcSetFulfilled
? { ...expendWidthHeight, ...heightWidth, ...hiddenStyle }
: { ...expendWidthHeight, ...heightWidth }),
? { ...(isHeightOrWidthSet ? null : { expendWidthHeight }), ...heightWidth, ...hiddenStyle }
: { ...(isHeightOrWidthSet ? null : { expendWidthHeight }), ...heightWidth }),
}}
{...restImgProps}
/>
Expand Down

0 comments on commit fe1926c

Please sign in to comment.