1 回答
TA贡献1876条经验 获得超6个赞
FlatList从导入react-native。这就是您收到此错误的原因。使用此代码。
import React, { Component } from 'react';
import { ScrollView, View, Text, Navigator, Alert, StyleSheet, FlatList } from 'react-native';
import { ListItem } from 'react-native-elements';
export default class Userlist extends React.Component {
constructor(props) {
super(props);
this.state = {
lastRefresh: '',
}
}
refresh() {
this.setState({ lastRefresh: Date(Date.now()).toString() });
}
// buildUserList() {
// var users = this.fbUser.getUserList();
// return users;
// }
renderRow({ item }) {
return (
<ListItem
roundAvatar
title={item.name}
subtitle={item.subtitle}
leftAvatar={{
source: {
uri: item.avatar_url
}
}}
/>
)
}
render() {
var list = [
{
name: 'Amy Farha',
avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg',
subtitle: 'Vice President'
},
{
name: 'Chris Jackson',
avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg',
subtitle: 'Vice Chairman'
}
]
return (
<FlatList
data={list}
renderItem={this.renderRow}
keyExtractor={item => item.name}
/>
)
}
}
添加回答
举报