TypeError: undefined is not an object (evaluating 'this._layouts[i].x')
See original GitHub issueI’m trying to implement search (as the user types in the search box) on the list. However, I’m getting the following error TypeError: undefined is not an object (evaluating 'this._layouts[i].x')
.
When the search string (value) is empty and the list is updated with all the elements, the error occurs. I also tried different conditions such as returning originalList
when value is ‘’, but it throws the same error as the list is updated with all the elements.
This is my code-
constructor(props) {
super(props);
let list = [{ name: 'Item1' }, { name: 'Item2' }];
this._dataProvider = new DataProvider((r1, r2) => {
return r1.name !== r2.name;
});
this.state = {
list,
originalList: _.clone(list),
dataProvider: this._dataProvider.cloneWithRows(list)
};
}
search(value) {
this.setState(prevState => {
return {
list: _.filter(prevState.originalList, item=> {
return value == '' || _.includes(item.name, value);
})
};
});
}
render() {
return (
<Input
placeholder="Search"
autoFocus
onChangeText={value => {
this.search(value);
}}
/>
<RecyclerListView
layoutProvider={this._layoutProvider}
dataProvider={this.state.dataProvider.cloneWithRows(this.state.list)}
rowRenderer={this._rowRenderer.bind(this)}
/>
);
}
Any help would be much appreciated.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8
Top Results From Across the Web
undefined is not an object (evaluating 'M.layout.force') - Stack ...
I'm new to JSNetworkX. I created a graph using the examples from jsnetworkx.org but I can only log it, I can't display it....
Read more >undefined is not an object (evaluating 'layout.levels[intersect[0 ...
I am generating a diagram programmatically and now getting this quite often: TypeError: undefined is not an object (evaluating ...
Read more >LWC - TypeError: undefined is not an object (evaluating 'e ...
TypeError : undefined is not an object (evaluating 'e.detail.value'). Functions are all working, but throwing me this error. Any idea of why and...
Read more >Error: undefined is not an object (evaluating 'i.status') when ...
So I'm trying to register a user manually using velo. I followed the documentation pretty closely but I still get this error: Error:...
Read more >TypeError: undefined is not an object (evaluating 'b.prototype')
[This thread is closed.] Getting this console error on frontend user profiles TypeError: undefined is not an object (evaluating 'b.…
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @sksin28 Thanks for pointing out this issue but even after making the change you recommended, still the issue exists. I got a workaround(hack) for this but still didn’t find a good solution.
The issue has been resolved. The dataprovider was not passed correctly which I believe resulted in dataprovider and list not being in sync.
So that no one else faces this issue, this is what my earlier code looked like-
After changing the dataprovider property, the code looks like-
@naqvitalha Thanks anyways.