1

我需要渲染方形头像。我该怎么做?

我已经实现了 react native element 文档提供的 listItem 代码:​​https://react-native-training.github.io/react-native-elements/docs/listitem.html

它运作良好,但在这个版本的 react native element 1.1.0 中,我不知道如何渲染方形头像而不是圆形。

 <ListItem
        title={item.name}
        subtitle={item.subtitle}
        leftAvatar={{ source: { uri: item.icon } }}
    />

我需要让左方头像填充列表视图高度。

4

1 回答 1

3

您可以将rounded道具指定为false

带道具:

<ListItem
    title={item.name}
    subtitle={item.subtitle}
    leftAvatar={{ source: { uri: item.icon }, rounded: false}}
/>

或与组件:

<ListItem
    title={item.name}
    subtitle={item.subtitle}
    leftAvatar={<Avatar source={{uri: item.icon}} rounded={false} /> }
/>

https://react-native-training.github.io/react-native-elements/docs/avatar.html#avatar-props

于 2019-06-29T05:44:02.180 回答