@@ -49,6 +49,9 @@ const ImageRenderer = ({
4949 const [ showDefaultComponent , setShowDefaultComponent ] = useState ( false ) ;
5050 const [ showPlaceHolder , setShowPlaceHolder ] = useState ( true ) ;
5151
52+ const parsedWidth = numberToPx ( width ) ;
53+ const parsedHeight = numberToPx ( height ) ;
54+
5255 const DefaultComponent = useMemo ( ( ) => {
5356 return typeof defaultComponent === 'function'
5457 ? defaultComponent ( )
@@ -60,9 +63,9 @@ const ImageRenderer = ({
6063 ? placeHolder ( {
6164 style : {
6265 width : '100%' ,
63- minWidth : width ,
64- maxWidth : fixedSize ? width : '400px' ,
65- height,
66+ minWidth : parsedWidth ,
67+ maxWidth : fixedSize ? parsedWidth : '400px' ,
68+ height : parsedHeight ,
6669 position : 'absolute' ,
6770 display : 'flex' ,
6871 justifyContent : 'center' ,
@@ -100,9 +103,9 @@ const ImageRenderer = ({
100103 ] . join ( ' ' ) }
101104 style = { {
102105 width : '100%' ,
103- minWidth : width ,
104- maxWidth : fixedSize ? width : '400px' ,
105- height,
106+ minWidth : parsedWidth ,
107+ maxWidth : fixedSize ? parsedWidth : '400px' ,
108+ height : parsedHeight ,
106109 } }
107110 >
108111 { showPlaceHolder && PlaceHolder }
@@ -114,9 +117,9 @@ const ImageRenderer = ({
114117 className = "sendbird-image-renderer__image"
115118 style = { {
116119 width : '100%' ,
117- minWidth : width ,
118- maxWidth : fixedSize ? width : '400px' ,
119- height,
120+ minWidth : parsedWidth ,
121+ maxWidth : fixedSize ? parsedWidth : '400px' ,
122+ height : parsedHeight ,
120123 position : 'absolute' ,
121124 backgroundRepeat : 'no-repeat' ,
122125 backgroundPosition : 'center' ,
0 commit comments