[Feature Request] `getStableId` should have a collection as a 2nd parameter
See original GitHub issueHaving getStableId
in DataProvider
as a function of only index
requires to keep the collection hanging somewhere (in the example code you have it hanging in the closure as a local variable of the constructor), then when the collection changes we have to change the getStableId
so it will link to the new collection, still this causes other issues.
It would be much much simpler if getStableId
has a signature like:
(index:number, rows:Array) => any
Then the getStableId
logic could be specified just once, for example if I have an array of some objects with some ids it would be as simple as
dataProvider = new DataProvider(
(r1, r2) => {
return r1.id !== r2.id
},
(index, rows) => {
return rows[index].id
}
)
DataProvider has these rows anyways, so for me it’s strange that I must provide them from the outside.
For example FlatList
gives an item at the index in its keyextractor callback. That’s also an option.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:5
Top GitHub Comments
That makes sense. @arunreddy-flipkart Let’s add this.
@naqvitalha any news on that? Should I create PR? 😃