using default and map funcitons instead of raw imports

This commit is contained in:
Nouman Tahir 2021-05-18 14:53:12 +05:00
parent e0a3dddd3a
commit acf4fab4bf
2 changed files with 7 additions and 7 deletions

View File

@ -11,7 +11,7 @@ import CommunityContainer from '../container/communityContainer';
// Styles
import styles from './communityStyles';
import { COMMUNITY_SCREEN_FILTER_MAP } from '../../../constants/options/filters';
import { getDefaultFilters, getFilterMap } from '../../../constants/options/filters';
import { useAppSelector } from '../../../hooks';
const CommunityScreen = ({ navigation }) => {
@ -20,8 +20,8 @@ const CommunityScreen = ({ navigation }) => {
const intl = useIntl();
const communityTabs = useAppSelector((state) => state.customTabs.communityTabs);
const filterOptions = communityTabs.map((key) => COMMUNITY_SCREEN_FILTER_MAP[key]);
const communityTabs = useAppSelector((state) => state.customTabs.communityTabs || getDefaultFilters('community'));
const filterOptions = communityTabs.map((key) => getFilterMap('community')[key]);
const _getSelectedIndex = () => {
if (filter) {

View File

@ -13,15 +13,15 @@ import { AccountContainer } from '../../../containers';
import styles from './feedStyles';
import {
FEED_SCREEN_FILTER_MAP,
DEFAULT_FEED_FILTERS,
getDefaultFilters, getFilterMap,
} from '../../../constants/options/filters';
import { useAppSelector } from '../../../hooks';
const FeedScreen = () => {
const mainTabs = useAppSelector((state) => state.customTabs.mainTabs || DEFAULT_FEED_FILTERS);
const filterOptions = mainTabs.map((key) => FEED_SCREEN_FILTER_MAP[key]);
const mainTabs = useAppSelector((state) => state.customTabs.mainTabs || getDefaultFilters('main'));
const filterOptions = mainTabs.map((key) => getFilterMap('main')[key]);
return (
<AccountContainer>