oblador / react-native-collapsible

Animated collapsible component for React Native, good for accordions, toggles etc
MIT License
2.45k stars 451 forks source link

how to search in items and rerender items #308

Open iamir4g opened 5 years ago

iamir4g commented 5 years ago

hi i want to search in array of my data my search function work true but i dont know how to show serach item . my data array comes from Web API and i use Redux-Thunk save in props. this is my search function : updateSearch = search => { console.log("text search is : " + search) const data = _.filter(this.props.data, user => { console.log(user.POSDESCRIPTION) if (user.POSDESCRIPTION.includes(search)) { return true } else { return false } }); console.log("data serach is : " + JSON.stringify(data)) this.setState({ search: search }) };

and this is my model of data : 0: CONTACTPERSONID: 2017011300 ENABLEPOLL: 0 HARDWAREID: 409792319815 LANDMARKID: 0 MESSAGETIME: "3دقيقه پيش" MOVINGSTATE: "s" NICKNAME: "ایران 78 - 875 ع 73" POSDESCRIPTION: "ايران: تهران: محمدشهر، به سمت جنوب غربی، 4 کیلومتر" SENTDATE: "10:43" SENTDATE1: "1398-07-02 10:43:04" SIGNATURE: "1-Normal" SPEED: 0 TRUCKSTATE: "متوقف" VEHICLETYPE: 0 XPOINT: 50.888305 YPOINT: 35.737926 __proto__: Object 1: {HARDWAREID: 2225434572, NICKNAME: "عابدین پور 938ع43", SENTDATE: "1398-07-01 10:15", XPOINT: 49.79252, YPOINT: 36.32362, …} how to when search in array remove section does not match and when remove text in search bar all of item comes back and show ??