diff --git a/index.js b/index.js index 655e3b3..adc503d 100644 --- a/index.js +++ b/index.js @@ -72,6 +72,9 @@ const ScalableImage = props => { const adjustSize = (sourceWidth, sourceHeight, localProps) => { const { width, height } = localProps; + sourceWidth = Math.max(sourceWidth, 1); + sourceHeight = Math.max(sourceWidth, 1); + let ratio = 1; if (width && height) { @@ -95,16 +98,11 @@ const ScalableImage = props => { } }; - if (!props.onPress) { - return image; - } - else { - return ( - - {image} - - ); - } + return !props.onPress ? image : ( + + {image} + + ); }; ScalableImage.propTypes = {