this.arrayholder.filter is not a function #18184
Labels
Ran Commands
One of our bots successfully processed a command.
Resolution: Locked
This issue was locked by the bot.
import React, { Component } from "react";
import { View, Text, FlatList, ActivityIndicator, TouchableOpacity } from "react-native";
import { List, ListItem, SearchBar } from "react-native-elements";
import {Actions } from 'react-native-router-flux';
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%"
}}
/>
);
};
SearchFilterFunction(text){
console.log(this.arrayholder);
const newData = this.arrayholder.filter(function(item){
const itemData = item.name.first.toUpperCase()
const textData = text.toUpperCase()
return itemData.indexOf(textData) > -1
})
this.setState({
dataSource: this.state.dataSource.cloneWithRows(newData),
text: text
})
}
renderHeader = () => {
};
renderFooter = () => {
if (!this.state.loading) return null;
};
render() {
return (
<List containerStyle={{ borderTopWidth: 0, borderBottomWidth: 0 }}>
<FlatList
data={this.state.data}
renderItem={({ item }) => (
<ListItem
}
}
export default FlatListDemo;
The text was updated successfully, but these errors were encountered: