put back images toggle in profile, communities and tag screens

This commit is contained in:
Nouman Tahir 2021-04-26 01:03:15 +05:00
parent f8e1829e97
commit 0891929ee0
5 changed files with 23 additions and 4 deletions

View File

@ -254,7 +254,7 @@ class ProfileView extends PureComponent {
isFeedScreen={false} isFeedScreen={false}
tabContentOverrides={tabContentOverrides} tabContentOverrides={tabContentOverrides}
onChangeTab={this._onTabChange} onChangeTab={this._onTabChange}
imagesToggleEnabled={false} imagesToggleEnabled={true}
/> />
</View> </View>
); );

View File

@ -15,7 +15,7 @@ export const TabbedPosts = ({
feedUsername, feedUsername,
pageType, pageType,
tabContentOverrides, tabContentOverrides,
imagesToggleEnabled = true, imagesToggleEnabled,
stackedTabs, stackedTabs,
onTabChange, onTabChange,
...props ...props
@ -89,6 +89,7 @@ export const TabbedPosts = ({
secondStack={subFilters} secondStack={subFilters}
initialFirstStackIndex={selectedOptionIndex} initialFirstStackIndex={selectedOptionIndex}
onFilterSelect={_onFilterSelect} onFilterSelect={_onFilterSelect}
toggleHideImagesFlag={imagesToggleEnabled}
/> />
) )
} }

View File

@ -1,6 +1,8 @@
import React, { useRef, useState } from "react"; import React, { useRef, useState } from "react";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
import { useDispatch, useSelector } from "react-redux";
import { CustomiseFiltersModal, FilterBar } from "../.."; import { CustomiseFiltersModal, FilterBar } from "../..";
import { hidePostsThumbnails } from "../../../redux/actions/uiAction";
import { CustomiseFiltersModalRef } from "../../customiseFiltersModal/customiseFiltersModal"; import { CustomiseFiltersModalRef } from "../../customiseFiltersModal/customiseFiltersModal";
export interface TabItem { export interface TabItem {
@ -18,6 +20,7 @@ interface StackedTabBarProps {
secondStack:TabItem[]; secondStack:TabItem[];
initialFirstStackIndex:number; initialFirstStackIndex:number;
onFilterSelect:(filterKey:string)=>void; onFilterSelect:(filterKey:string)=>void;
toggleHideImagesFlag:boolean;
} }
export const StackedTabBar = ({ export const StackedTabBar = ({
@ -29,12 +32,18 @@ export const StackedTabBar = ({
secondStack, secondStack,
initialFirstStackIndex, initialFirstStackIndex,
onFilterSelect, onFilterSelect,
toggleHideImagesFlag
}:StackedTabBarProps) => { }:StackedTabBarProps) => {
const dispatch = useDispatch();
const intl = useIntl();
const customiseModalRef = useRef<CustomiseFiltersModalRef>(); const customiseModalRef = useRef<CustomiseFiltersModalRef>();
const intl = useIntl(); //redux properties
const isHideImages = useSelector((state) => state.ui.hidePostsThumbnails);
const [selectedFilterIndex, setSelectedFilterIndex] = useState(initialFirstStackIndex); const [selectedFilterIndex, setSelectedFilterIndex] = useState(initialFirstStackIndex);
const [selectedSecondStackIndex, setSelectedSecondStackIndex] = useState(0); const [selectedSecondStackIndex, setSelectedSecondStackIndex] = useState(0);
@ -44,6 +53,10 @@ export const StackedTabBar = ({
} }
} }
const _onToggleImagesPress = () => {
dispatch(hidePostsThumbnails(!isHideImages))
}
return ( return (
<> <>
<FilterBar <FilterBar
@ -55,6 +68,8 @@ export const StackedTabBar = ({
} }
selectedOptionIndex={selectedFilterIndex} selectedOptionIndex={selectedFilterIndex}
rightIconName={toggleHideImagesFlag && "view-module"}
rightIconType={toggleHideImagesFlag && "MaterialIcons"}
enableCustomiseButton={enableCustomiseButton} enableCustomiseButton={enableCustomiseButton}
onCustomisePress={_onCustomisePress} onCustomisePress={_onCustomisePress}
onDropdownSelect={(index)=>{ onDropdownSelect={(index)=>{
@ -70,6 +85,7 @@ export const StackedTabBar = ({
} }
}} }}
onRightIconPress={_onToggleImagesPress}
/> />
{ {

View File

@ -106,6 +106,7 @@ const CommunityScreen = ({ navigation }) => {
filterOptionsValue={GLOBAL_POST_FILTERS_VALUE} filterOptionsValue={GLOBAL_POST_FILTERS_VALUE}
selectedOptionIndex={_getSelectedIndex()} selectedOptionIndex={_getSelectedIndex()}
tag={tag} tag={tag}
imagesToggleEnabled={true}
/> />
</View> </View>
</View> </View>

View File

@ -69,6 +69,7 @@ const TagResultScreen = ({ navigation }) => {
filterOptionsValue={GLOBAL_POST_FILTERS_VALUE} filterOptionsValue={GLOBAL_POST_FILTERS_VALUE}
selectedOptionIndex={_getSelectedIndex()} selectedOptionIndex={_getSelectedIndex()}
tag={tag} tag={tag}
imagesToggleEnabled={true}
/> />
</View> </View>
</View> </View>