Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get index of item passed to renderItem? #1

Open
meganlwood opened this issue Feb 20, 2018 · 2 comments
Open

Get index of item passed to renderItem? #1

meganlwood opened this issue Feb 20, 2018 · 2 comments

Comments

@meganlwood
Copy link

When using the FlatList, I need to pass the index in the list down to the component. When using the regular flatlist, this worked without problem. When I switched to RNFlatListWithEnd, the parameter in renderItem no longer had an "index" property. I printed out the parameter as JSON with each FlatList and included them here.

With RNFlatListWithEnd:
{"item":{"title":"Math","list":[{"item":"Practice basic algebra","complete":true},{"item":"Learn about variables","complete":false}],"complete":false}}

With regular FlatList:
{"item":{"title":"Math","list":[{"item":"Practice basic algebra","complete":true},{"item":"Learn about variables","complete":false}],"complete":false},"index":1,"separators":{}}

As you can see, the original FlatList added "index" and "separators".

@badarshahzad
Copy link

Hi 👋 ,
Yes, I have also noticed the index is not correct. It always came as 0 or undefined.

@badarshahzad
Copy link

@meganlwood I have solved the issue you can check the pull request. 💯 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants