react-native-select-two
react-native-select-two copied to clipboard
using select twice in app
i want to use two react-native-select-two component in my Js Class. Unfortunately after change one of them, another select selected data changes. state variables name is different.
how can i use two Select Two component ?
same problem
Hello I hope you are well, sorry for my english
the problem basically is not of librarie, the problem is the way you implement, let me explain it, you are using redux I guess redux is inmutable but in this case is not true, for solve this you have to make this way
let neighbords_subscribes = neighborhoods.map((value:any) => ({...value}));
or
let neighbords_subscribes:any = [];
neighborhoods.forEach( (element:any) => { let temp:any = new Object(); for (var name in element) { temp[name] = element[name] } neighbords_subscribes.push(temp); });
where neighborhoods is the array of objects from redux and here you make a real deep copy, remember map return new array, or foreach is the same in this case, choose what you want, so each time you visita page you have to run this function and solve the problem.
I hopre this can help some one