react-native-draggable-grid
react-native-draggable-grid copied to clipboard
property 'x' of undefined
<DraggableGrid numColumns={4} renderItem={this.renderGridViewItem} data={products} onDragRelease={data => { this.setState({data}); }} />
Each item should have a unique key prop to get rid of that error
this is still relevant and it's always showing - even with a proper unique key, seems like it's not even looking for the key prop in the rendered element...
Confirmed, setting the key doesn't affect the error. Couldn't make it work.
If you use the index of the array, I don't know why but does't work! You can generate an unique key in your object and use it! For me it's work!
is the issue resolved?please solve it. seems like a buggy pacckage
the problem is in duplicated items by key. If there are 2 or more items with same key value, it will crash
@kwkeat You need to have a key named 'key' inside the object you're passing to data here's cheap fix for that
<DraggableGrid
numColumns={4}
renderItem={this.render_item}
data={this.state.data.map(obj => ({ ...obj, key: uuid.v4() }))}
onDragRelease={(data) => {
this.setState({data});// need reset the props data sort after drag release
}}
/>
I'll raise a pr to fix this issue
the problem is in duplicated items by key. If there are 2 or more items with same
keyvalue, it will crash
thanks, you save my time