【问题标题】:How do I render square ListItem avatar instead of round?如何渲染方形 ListItem 头像而不是圆形?
【发布时间】:2019-06-29 05:04:46
【问题描述】:

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

我已经实现了 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 } }}
    />

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

【问题讨论】:

    标签: react-native expo react-native-elements


    【解决方案1】:

    您可以将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

    【讨论】:

      猜你喜欢
      • 2013-07-16
      • 2023-03-26
      • 2016-08-07
      • 2012-04-21
      • 2023-04-01
      • 1970-01-01
      • 2015-08-01
      • 1970-01-01
      • 2015-09-01
      相关资源
      最近更新 更多