Followers

ReactNative Checkbox cant be pressed more than 1 time in Android?

ReactNative Checkbox cant be pressed more than 1 time in Android?


Facing issues with checkbox selection in FlatList in Android/iOS, well then you are on the right page to find the working solution.










Solution:


Step1: While forming the list to be mapped to your FlatList, map the list and add a boolean flag to maintain the state of Checkbox selection.

Step2: Set the value of Checkbox as the flag stored in your item rendered from the FlatList and onValueChange pass the index and change the flag value of the respective index of the array.

Step3: (Solution to overcome this issue in Android device) Map the array rendered in FlatList and push each item to the new array/temporary array initialised and set the temporary array to your actual array. This resolves the issue in Android and in the same render the checkbox works absolutely fine.





You can find the complete source code here



Stay tuned to my posts  and do share your valuable thoughts if any queries or you would like to share anything on this topic in the comment section and please do like and share my post if this was helpful.


Hope this helped you!!



Post a Comment

0 Comments