From 0891929ee0cfba3a79ec7d4800cef8b696914e81 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Mon, 26 Apr 2021 01:03:15 +0500 Subject: [PATCH] put back images toggle in profile, communities and tag screens --- src/components/profile/profileView.js | 2 +- .../tabbedPosts/container/tabbedPosts.tsx | 3 ++- .../tabbedPosts/view/stackedTabBar.tsx | 20 +++++++++++++++++-- .../community/screen/communityScreen.js | 1 + .../tagResult/screen/tagResultScreen.js | 1 + 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/components/profile/profileView.js b/src/components/profile/profileView.js index 9fd7e2a90..b77e22fb6 100644 --- a/src/components/profile/profileView.js +++ b/src/components/profile/profileView.js @@ -254,7 +254,7 @@ class ProfileView extends PureComponent { isFeedScreen={false} tabContentOverrides={tabContentOverrides} onChangeTab={this._onTabChange} - imagesToggleEnabled={false} + imagesToggleEnabled={true} /> ); diff --git a/src/components/tabbedPosts/container/tabbedPosts.tsx b/src/components/tabbedPosts/container/tabbedPosts.tsx index d60a31cbf..321c93fa3 100644 --- a/src/components/tabbedPosts/container/tabbedPosts.tsx +++ b/src/components/tabbedPosts/container/tabbedPosts.tsx @@ -15,7 +15,7 @@ export const TabbedPosts = ({ feedUsername, pageType, tabContentOverrides, - imagesToggleEnabled = true, + imagesToggleEnabled, stackedTabs, onTabChange, ...props @@ -89,6 +89,7 @@ export const TabbedPosts = ({ secondStack={subFilters} initialFirstStackIndex={selectedOptionIndex} onFilterSelect={_onFilterSelect} + toggleHideImagesFlag={imagesToggleEnabled} /> ) } diff --git a/src/components/tabbedPosts/view/stackedTabBar.tsx b/src/components/tabbedPosts/view/stackedTabBar.tsx index cd97079e0..e0b550793 100644 --- a/src/components/tabbedPosts/view/stackedTabBar.tsx +++ b/src/components/tabbedPosts/view/stackedTabBar.tsx @@ -1,6 +1,8 @@ import React, { useRef, useState } from "react"; import { useIntl } from "react-intl"; +import { useDispatch, useSelector } from "react-redux"; import { CustomiseFiltersModal, FilterBar } from "../.."; +import { hidePostsThumbnails } from "../../../redux/actions/uiAction"; import { CustomiseFiltersModalRef } from "../../customiseFiltersModal/customiseFiltersModal"; export interface TabItem { @@ -18,6 +20,7 @@ interface StackedTabBarProps { secondStack:TabItem[]; initialFirstStackIndex:number; onFilterSelect:(filterKey:string)=>void; + toggleHideImagesFlag:boolean; } export const StackedTabBar = ({ @@ -29,12 +32,18 @@ export const StackedTabBar = ({ secondStack, initialFirstStackIndex, onFilterSelect, + toggleHideImagesFlag }:StackedTabBarProps) => { - const customiseModalRef = useRef(); - + const dispatch = useDispatch(); const intl = useIntl(); + + const customiseModalRef = useRef(); + + //redux properties + const isHideImages = useSelector((state) => state.ui.hidePostsThumbnails); + const [selectedFilterIndex, setSelectedFilterIndex] = useState(initialFirstStackIndex); const [selectedSecondStackIndex, setSelectedSecondStackIndex] = useState(0); @@ -44,6 +53,10 @@ export const StackedTabBar = ({ } } + const _onToggleImagesPress = () => { + dispatch(hidePostsThumbnails(!isHideImages)) + } + return ( <> { @@ -70,6 +85,7 @@ export const StackedTabBar = ({ } }} + onRightIconPress={_onToggleImagesPress} /> { diff --git a/src/screens/community/screen/communityScreen.js b/src/screens/community/screen/communityScreen.js index d8086af32..6a761d88b 100644 --- a/src/screens/community/screen/communityScreen.js +++ b/src/screens/community/screen/communityScreen.js @@ -106,6 +106,7 @@ const CommunityScreen = ({ navigation }) => { filterOptionsValue={GLOBAL_POST_FILTERS_VALUE} selectedOptionIndex={_getSelectedIndex()} tag={tag} + imagesToggleEnabled={true} /> diff --git a/src/screens/tagResult/screen/tagResultScreen.js b/src/screens/tagResult/screen/tagResultScreen.js index 02103deaf..597450804 100644 --- a/src/screens/tagResult/screen/tagResultScreen.js +++ b/src/screens/tagResult/screen/tagResultScreen.js @@ -69,6 +69,7 @@ const TagResultScreen = ({ navigation }) => { filterOptionsValue={GLOBAL_POST_FILTERS_VALUE} selectedOptionIndex={_getSelectedIndex()} tag={tag} + imagesToggleEnabled={true} />