Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

onPress executing two times for work properly

$
0
0

i have an issue this is issue is function i create to clear and collapse my information doesn't work correctly here need i press two times to work.

  const collapseItemList = (item: Speciality) => {    const newSpecialty = specialtiesList.map((specialty) => {      if (specialty.id === item.id) {        return {          ...specialty,          status: !specialty.status,        };      }      return specialty;    });    setSpecialtiesList(newSpecialty);   //this part of code is for clear an array a recive from db    const newSpecialtyData = dataSpecialties.filter((specialty) => {      if (specialty.specialtyId === Number(item.id)) {        return false      }      return true;    });    setDataSpecialtes(newSpecialtyData);  };

i need clear this information and collapse my info, image below represent his opened with this info i need close her in only one press

Below is my code for this function


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>