|
@@ -159,6 +159,7 @@ const SearchPage = props => {
|
|
getMenus()
|
|
getMenus()
|
|
.then(res => {
|
|
.then(res => {
|
|
let filtersPayload = res.data.body.results
|
|
let filtersPayload = res.data.body.results
|
|
|
|
+ //Reduce Submenus into a object
|
|
setFiltersData(prev => ({ ...prev, "Category": filtersPayload.map(item => item.heading.submenu.reduce((current, value) => ({ ...current, [value]: false }), {})) }))
|
|
setFiltersData(prev => ({ ...prev, "Category": filtersPayload.map(item => item.heading.submenu.reduce((current, value) => ({ ...current, [value]: false }), {})) }))
|
|
setFiltersData(prev => ({ ...prev, "Source": filtersPayload.map(item => item.heading.submenu.reduce((current, value) => ({ ...current, [value]: false }), {})) }))
|
|
setFiltersData(prev => ({ ...prev, "Source": filtersPayload.map(item => item.heading.submenu.reduce((current, value) => ({ ...current, [value]: false }), {})) }))
|
|
setFiltersData(prev => ({ ...prev, "Hash Tags": filtersPayload.map(item => item.heading.submenu.reduce((current, value) => ({ ...current, [value]: false }), {})) }))
|
|
setFiltersData(prev => ({ ...prev, "Hash Tags": filtersPayload.map(item => item.heading.submenu.reduce((current, value) => ({ ...current, [value]: false }), {})) }))
|
|
@@ -239,17 +240,17 @@ const SearchPage = props => {
|
|
{
|
|
{
|
|
// filtersData[currentFilter]
|
|
// filtersData[currentFilter]
|
|
Object.keys(filtersData).length <= 0 ? <LoadingScreen/>
|
|
Object.keys(filtersData).length <= 0 ? <LoadingScreen/>
|
|
- : Object.keys(filtersData[currentFilter]).map(item =>
|
|
|
|
- { console.log(item)
|
|
|
|
|
|
+ : Object.entries(filtersData[currentFilter]).map(item =>
|
|
|
|
+ {
|
|
return (<List.Item
|
|
return (<List.Item
|
|
style={styles.listItem}
|
|
style={styles.listItem}
|
|
titleStyle={styles.listItemText}
|
|
titleStyle={styles.listItemText}
|
|
- title={item}
|
|
|
|
|
|
+ title={item[0]}
|
|
|
|
|
|
right={props => <Checkbox
|
|
right={props => <Checkbox
|
|
- status={filtersData[currentFilter][item] === true ? 'checked' : 'unchecked'}
|
|
|
|
|
|
+ status={filtersData[currentFilter][item[0]] === true ? 'checked' : 'unchecked'}
|
|
onPress={() =>
|
|
onPress={() =>
|
|
- setFiltersData({...filtersData,[currentFilter]: {...filtersData[currentFilter],[item]: !filtersData[currentFilter][item]}})}
|
|
|
|
|
|
+ setFiltersData({...filtersData,[currentFilter]: {...filtersData[currentFilter],[item[0]]: !filtersData[currentFilter][item[0]]}})}
|
|
// setSelectedTopics({...filtersData,[item.heading.name]: !selectedTopics[item.heading.name]})}
|
|
// setSelectedTopics({...filtersData,[item.heading.name]: !selectedTopics[item.heading.name]})}
|
|
color={colors().secondaryColor}
|
|
color={colors().secondaryColor}
|
|
/>}
|
|
/>}
|