简体   繁体   中英

Sending only checked check-boxes to server in React Native

I am having trouble with one thing in my app. After my teacher logs in, he should be able to offer some reservation times for offering classes. After he clicks on the date under date-picker is rendered my custom time component with a checkbox. Then he should decide if he wants to have the class in that particular time and if not he will uncheck this box and save it(send new information to the server, with updated time that he is able to have classes). But I don't really know how to find out which checkboxes are really checked and how can I send the only array with checked times. Added pictures will describe it better. In the picture, I want only send those checked times to the server.我在模拟器中的反应应用程序

I suggest you to store the checkboxes inside an other div element.

Programatically you could get that div element, and can get trough its childs.

For every child check if it is checked, if checked send it to the server, if not checked do not send it. If you want to send it to the server only once, store the data in an array, then send the array to the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM