-
-
Save spencercarli/85c289a686c518d63368a37908e8ca9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AppRegistry } from "react-native"; | |
import FlatListDemo from "./FlatListDemo"; | |
AppRegistry.registerComponent("FlatListDemo", () => FlatListDemo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AppRegistry } from "react-native"; | |
import FlatListDemo from "./FlatListDemo"; | |
AppRegistry.registerComponent("FlatListDemo", () => FlatListDemo); |
what is the reason and please fixing code
iam a trainee of redbytes software company please reslove issue
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
import { AppRegistry) from " react-native";
import FlatListDemo from"./FlatListDemo";
import { List, ListItem, SearchBar } from "react-native-elements";
class FlatListDemo extends Component {
constructor(props) {
super(props);
}
componentDidMount() {
this.makeRemoteRequest();
}
makeRemoteRequest = () => {
const { page, seed } = this.state;
const url =
https://randomuser.me/api/?seed=${seed}&page=${page}&results=20
;this.setState({ loading: true });
};
handleRefresh = () => {
this.setState(
{
page: 1,
seed: this.state.seed + 1,
refreshing: true
},
() => {
this.makeRemoteRequest();
}
);
};
handleLoadMore = () => {
this.setState(
{
page: this.state.page + 1
},
() => {
this.makeRemoteRequest();
}
);
};
renderSeparator = () => {
return (
<View
style={{
height: 1,
width: "86%",
backgroundColor: "#CED0CE",
marginLeft: "14%"
}}
/>
);
};
renderHeader = () => {
return ;
};
renderFooter = () => {
if (!this.state.loading) return null;
};
render() {
return (
<List containerStyle={{ borderTopWidth: 0, borderBottomWidth: 0 }}>
<FlatList
data={this.state.data}
renderItem={({ item }) => (
<ListItem
roundAvatar
title={
${item.name.first} ${item.name.last}
}subtitle={item.email}
avatar={{ uri: item.picture.thumbnail }}
containerStyle={{ borderBottomWidth: 0 }}
/>
)}
keyExtractor={item => item.email}
ItemSeparatorComponent={this.renderSeparator}
ListHeaderComponent={this.renderHeader}
ListFooterComponent={this.renderFooter}
onRefresh={this.handleRefresh}
refreshing={this.state.refreshing}
onEndReached={this.handleLoadMore}
onEndReachedThreshold={50}
/>
);
}
}