Skip to content

Commit

Permalink
allow aspect ratio when placeholder set to false
Browse files Browse the repository at this point in the history
  • Loading branch information
bluebill1049 committed Mar 9, 2019
1 parent ed6d4e6 commit e5b5d73
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/simpleImg.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default class SimpleImg extends React.PureComponent<Props, State> {
...restImgProps,
};

if (placeholder === false) {
if (placeholder === false && !applyAspectRatio) {
return (
<img
style={{
Expand Down Expand Up @@ -222,6 +222,12 @@ export default class SimpleImg extends React.PureComponent<Props, State> {
...(isHeightAndWidthNotSet ? expendWidth : heightWidth),
...(!isValidImgSrc && !isSrcSetFulfilled ? hiddenStyle : {}),
...(shouldUseAspectRatio ? aspectRatioChildStyle : null),
...(placeholder === false
? {
transition: `${animationDuration}s all`,
opacity: 0,
}
: null),
}}
{...imageProps}
/>
Expand Down

0 comments on commit e5b5d73

Please sign in to comment.