我在FlatList中使用来自react原生元素的ListItem,代码是
render() {
return (
<View style={commonStyles.container}>
<List>
<FlatList
data={this.props.questions}
renderItem={({ item }) => (
<ListItem
roundAvatar
title={'nicola'}
/>
)}
/>
</List>
</View>
);
}问题是文本( 'nicola‘)没有被渲染

发布于 2018-08-08 11:55:40
我知道这已经很晚了,但我也遇到过同样的问题。
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>当我使用上面的代码时,只显示图标,但当我删除alignItems prop时,这个问题就解决了。
https://stackoverflow.com/questions/48490367
复制相似问题