Skip to content

Commit 21f9b97

Browse files
authored
[UIKIT-4314] Fixed ImageRenderer not converting number to pixel string. (#707)
1 parent 0582edc commit 21f9b97

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/ui/ImageRenderer/index.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)