【问题标题】:Why ListItem content not showing anything为什么 ListItem 内容没有显示任何内容
【发布时间】:2021-08-15 11:33:05
【问题描述】:

import {Avatar, ListItem} from 'react-native-elements';

 <View style={{flex: 3}}>
      <ListItem
        key="live-jobs"
        title="Live Jobs"
        textStyle={{color: 'orange'}}
        leftIcon={
          <Icon name="access-point" size={25} style={{color: '#4BC6FF'}} />
        }
        onPress={() =>
          this.checkPermissions(LIVE_JOB_END_POINT, 'liveJobs')
        }
      />
      <Text>Hiiii</Text>
      <ListItem
        key="notifications"
        title="Notifications"
        leftIcon={
          <Icon name="bell-ring" size={25} style={{color: '#4BC6FF'}} />
        }
        onPress={() => Actions.userManagement()}
      />
</View>

我的React-native版本是0.64.2,React Native Elements版本是3.4.2 为什么ListItem里面的内容什么都不显示?

【问题讨论】:

  • 我不太了解 react native(但我知道 react)问题,你是如何导入 Icon 组件的?
  • @laserany 从 'react-native-vector-icons/MaterialCommunityIcons' 导入图标;
  • 我在代码中没有看到?你会分享完整的sn-p吗?我正在查看reactnativeelements.com/docs/listitem 此处的文档,看来您实现 listItem 的方式不同?他们的例子是reactnativeelements.com/docs/listitem/…

标签: react-native react-native-elements


【解决方案1】:
  <ListItem key="live-jobs" bottomDivider>
    <Avatar source={{uri: l.avatar_url}} />
    <ListItem.Content>
      <ListItem.Title>Live Jobs</ListItem.Title>
      <ListItem.Subtitle>Subtitle</ListItem.Subtitle>
    </ListItem.Content>
  </ListItem>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多