ListItem 未显示 React Native 中“title”属性中的文本

Nic*_*tti 3 reactjs react-native

我使用的ListItem从在FlatList反应天然元素,代码

  render() {
    return (
      <View style={commonStyles.container}>
        <List>
          <FlatList
            data={this.props.questions}
            renderItem={({ item }) => (
              <ListItem
                roundAvatar
                title={'nicola'}
              />
            )}
          />
        </List>
      </View>
    );
  }
Run Code Online (Sandbox Code Playgroud)

问题是文本( 'nicola' )没有呈现

在此处输入图片说明

Jam*_*Yoo 10

我知道这已经很晚了,但我遇到了同样的问题。

const list = [
{
    name: 'Account',
    icon: 'av-timer'
},
{
    name: 'Category',
    icon: 'flight-takeoff'
},
{
    name: 'About',
    icon: 'av-timer'
}]

... // some code here

   <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
    {
        list.map((item, i) => (
            <ListItem
                key={i}
                title={item.name}
                leftIcon={{ name: item.icon }}
            />
         ))
    }
   </View>
Run Code Online (Sandbox Code Playgroud)

当我使用上面的代码时,只显示了图标,但是当我删除 alignItems 道具时问题得到了解决。

  • 我在超级视图上有 `alignItems: 'center'` 触发了相同的行为。删除 `alignItems` 有效。 (4认同)