Skip to content
Advertisement

How to render check box inside flatlist

I created a checkbox inside my flatlist but when I click on the checkbox all the check boxes will render. I want to render the checkbox I press not the entire checkboxes. This is my code.

JavaScript

this is my data.

JavaScript

Advertisement

Answer

you set a global state so it is selecting checkbox for all items

remove this

JavaScript

set array of selected id’s

JavaScript

on press set id in array and set check status from array

JavaScript

and in flatlist set extraData prop

JavaScript

to retrive selected id’s you can get from checked array

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement