reza fixed videos most viewed length and add config to products

master
Reza_ashrafi 3 years ago
parent 976723c402
commit 956ef9715c
  1. 4
      src/screens/Home/components/Header.js
  2. 16
      src/screens/Products/index.js
  3. 4
      src/screens/Videos/components/MostViewedVideo.js

@ -10,7 +10,7 @@ import tw from "tailwind-rn";
//Color
import Color from "../../../constants/Colors";
const Header = ({ title, route, mobile, theme }) => {
const Header = ({ title, route, mobile, theme, state = null }) => {
const navigation = useNavigation();
return (
<View style={tw(`w-full flex flex-row-reverse justify-between ${mobile ? "" : "mb-2"}`)}>
@ -26,7 +26,7 @@ const Header = ({ title, route, mobile, theme }) => {
{title}
</Text>
{route ? (
<Pressable onPress={() => navigation.navigate(route)} style={{transform: [{translateX : -fontSize.xl6 / 3}]}}>
<Pressable onPress={() => navigation.navigate(route, state)} style={{transform: [{translateX : -fontSize.xl6 / 3}]}}>
<Entypo name="chevron-small-left" size={fontSize.xl6} color={Color.theme1[theme].green79} />
</Pressable>
) : null}

@ -17,7 +17,14 @@ import Main from "./components/Main";
//style
function Products({ books, getBooks, grades }) {
function Products({
books,
getBooks,
grades,
route,
setFilterOptions,
filterOptions,
}) {
const [position, setPosition] = useState("100%");
useEffect(() => {
@ -29,6 +36,12 @@ function Products({ books, getBooks, grades }) {
setPosition(position === "100%" ? "0%" : "100%");
};
useEffect(() => {
if (route?.params?.productType === "دوره ویدئویی") {
setFilterOptions({ ...filterOptions, productType: "دوره ویدئویی" });
}
}, [route]);
return (
<SafeAreaView
style={{
@ -49,6 +62,7 @@ function Products({ books, getBooks, grades }) {
const mapStateToProps = (state) => ({
grades: state.publicApi.grades,
books: state.book.list,
filterOptions: state.book.filterOptions,
});
const mapDispatchToProps = {

@ -126,13 +126,13 @@ function MostViewedVideo({ videos, grades, mobile, theme }) {
return (
<View style={tw("w-full flex w-full mt-3")}>
<Header title="پربازدیدترین" />
<Header title="پربازدیدترین" route={"Products"} state={{productType : 'دوره ویدئویی'}} />
<FlatList
showsHorizontalScrollIndicator={false}
horizontal={true}
inverted={true}
style={tw("pb-1.5 mt-3 flex flex-row w-full")}
data={videos}
data={videos.slice(0,7)}
renderItem={({ item }) => <Video video={item} />}
keyExtractor={(item) => item.id}
/>

Loading…
Cancel
Save