在不知道图像尺寸的情况下,在react native中使用resizeMode contain设置borderRadiu



有没有想法如何将borderRadius添加到设置了resizeMode的图像中,而不知道高度和宽度?

代码当前看起来是这样的,但这不起作用。

<View
style={[
styles.imageContainerWrapper,
{ width: width },
]}
key={i}
>
<Image
source={{ uri: url }}
borderRadius={normalize(20)}
resizeMode="contain"
style={{
height: '100%',
maxWidth: '100%',
maxHeight: '100%',
overflow: 'hidden',
backgroundColor: 'blue',
}}
/>

borderRadius添加到图像的样式属性中,如下所示:

<View
style={[
styles.imageContainerWrapper,
{ width: width },
]}
key={i}
>
<Image
source={{ uri: url }}
resizeMode="contain"
style={{
height: '100%',
maxWidth: '100%',
maxHeight: '100%',
overflow: 'hidden',
backgroundColor: 'blue',
borderRadius: 20,
}}
/>

最新更新