fjmorant/react-native-nested-listview

add getChildrenId

violabg opened this issue · 4 comments

most of the time we retrive the data from a service, and the data already has an ID value, and often is called id. This could conflict with node id you are generating, or have unnecessary double ids.
Consider adding a function to set the name of the current data ID.

Hi @violabg,

Yes , I think it can collide with customer data, I will include it in the road map.

THanks

@violabg Opened a new PR that solves this issue, I need to check several things but this is the first approach

Thanks fjmorant,
correct me if I'm wrong, but if my data already has a unique ID for each node, we could use it when setting getNodeIdName without generating a new one with shortid.generate(). So that we don't have two separate ids one for the data and one for the list.

Hi @violabg,

I prefer to keep an internal id for each node (different than one provided by the user) because for future features and maintaining uniqueness it is better to rely on the library one.

In fact, I think this function getNodeIdNameshould not be in the API because that internal id it is a private info, I think I am going to change the internal id by something less common and I will check if it clashes or not with some field provided by the user

Thanks