From d80058393133880c76d896c87f675da5eb4c12eb Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Tue, 12 Apr 2022 18:03:33 +0430 Subject: [PATCH] reza fixed compo colors before Products --- src/screens/Product/components/Book.js | 76 +++++++++++------------ src/screens/Product/components/LinkBox.js | 10 +-- src/screens/Product/components/Rates.js | 22 +++---- 3 files changed, 52 insertions(+), 56 deletions(-) diff --git a/src/screens/Product/components/Book.js b/src/screens/Product/components/Book.js index f1706f7..6891ebc 100644 --- a/src/screens/Product/components/Book.js +++ b/src/screens/Product/components/Book.js @@ -6,7 +6,6 @@ import { ScrollView, TouchableHighlight, Dimensions, - Appearance, Platform, } from "react-native"; import { useNavigation } from "@react-navigation/native"; @@ -44,8 +43,8 @@ function Book({ userFavoriteLoading, mobile, userProducts, + theme }) { - const colorScheme = Appearance.getColorScheme(); const navigation = useNavigation(); const [type, setType] = useState(1); const [pageLoading, setPageLoading] = useState(false); @@ -80,9 +79,9 @@ function Book({ tw("absolute left-0 top-0 rounded-md overflow-hidden"), { width: Dimensions.get("window").width, - height: height - 200, + height: height - 110, zIndex: 1, - backgroundColor: Colors.theme1[colorScheme].white + "60", + backgroundColor: Colors.theme1[theme].white + "60", }, ]} > @@ -111,7 +110,7 @@ function Book({ @@ -244,7 +243,7 @@ function Book({ style={{ fontFamily: "bold", fontSize: fontSize.sm, - color: Colors.theme1[colorScheme].green79, + color: Colors.theme1[theme].green79, paddingVertical: 4, }} > @@ -258,7 +257,7 @@ function Book({ tw("py-1 pr-2"), { fontFamily: "bold", - color: Colors.theme1[colorScheme].green79, + color: Colors.theme1[theme].green79, fontSize: fontSize.sm, }, ]} @@ -270,13 +269,13 @@ function Book({ @@ -313,9 +312,9 @@ function Book({ tw("py-1 pr-2"), { borderRightWidth: 1, - borderColor: Colors.theme1[colorScheme].greenCF, + borderColor: Colors.theme1[theme].greenCF, fontFamily: "bold", - color: Colors.theme1[colorScheme].green79, + color: Colors.theme1[theme].green79, fontSize: fontSize.sm, }, ]} @@ -326,13 +325,13 @@ function Book({ @@ -350,13 +349,13 @@ function Book({ @@ -386,7 +385,7 @@ function Book({ tw("py-1 pr-2"), { fontFamily: "bold", - color: Colors.theme1[colorScheme].green79, + color: Colors.theme1[theme].green79, fontSize: fontSize.sm, }, ]} @@ -397,13 +396,13 @@ function Book({ @@ -479,6 +478,7 @@ const mapStateToProps = (state) => ({ userProductsLoading: state.userProduct.loading, userFavoriteLoading: state.userFavorite.loading, mobile: state.publicApi.mobile, + theme: state.publicApi.theme }); const mapDispatchToProps = { diff --git a/src/screens/Product/components/LinkBox.js b/src/screens/Product/components/LinkBox.js index 4c73f1b..9c7c6ef 100644 --- a/src/screens/Product/components/LinkBox.js +++ b/src/screens/Product/components/LinkBox.js @@ -9,8 +9,7 @@ import tw from "tailwind-rn"; import fontSize from "../../../constants/fontSize"; import Colors from "../../../constants/Colors"; -function Description({ title, component, height, mobile }) { - const colorScheme = Appearance.getColorScheme(); +function Description({ title, component, height, mobile, theme }) { const refRBSheet = useRef(); return ( <> @@ -21,7 +20,7 @@ function Description({ title, component, height, mobile }) { `flex flex-row-reverse justify-between items-center mt-3 rounded-sm px-5 ${mobile ? "py-4" : "py-4"}` ), { - backgroundColor: Colors.theme1[colorScheme].greenCF + '15', + backgroundColor: Colors.theme1[theme].greenCF + '15', // borderWidth : 1, }, ]} @@ -30,7 +29,7 @@ function Description({ title, component, height, mobile }) { style={[ { fontSize: mobile ? fontSize.sm : fontSize.lg, - color: Colors.theme1[colorScheme].green79, + color: Colors.theme1[theme].green79, fontFamily: "demi", }, tw(""), @@ -38,7 +37,7 @@ function Description({ title, component, height, mobile }) { > {title} - + ({ mobile: state.publicApi.mobile, + theme: state.publicApi.theme }); export default connect(mapStateToProps)(Description); diff --git a/src/screens/Product/components/Rates.js b/src/screens/Product/components/Rates.js index 8c8a164..9508a6c 100644 --- a/src/screens/Product/components/Rates.js +++ b/src/screens/Product/components/Rates.js @@ -1,5 +1,5 @@ import React from "react"; -import { View, Text, Dimensions, Appearance, Pressable } from "react-native"; +import { View, Text, Dimensions, Pressable } from "react-native"; import { Rating } from "react-native-ratings"; import { connect } from "react-redux"; import { vote } from "../../../redux/actions"; @@ -12,10 +12,7 @@ import Colors from "../../../constants/Colors"; const width = Dimensions.get("window").width; -function Rates({ rate, productId, addVote, isBuyed = null }) { - const ratingCompleted = (rating) => { - return; - }; +function Rates({ rate, productId, addVote, isBuyed = null, theme }) { return ( @@ -63,17 +60,14 @@ function Rates({ rate, productId, addVote, isBuyed = null }) { { name: "بخش ۱", value: 10 }, { name: "بخش ۱", value: 50 }, ].map((field, index) => ( - + ))} ); } -const Progress = ({ data, ...props }) => { - const colorScheme = React.useMemo(() => { - return Appearance.getColorScheme(); - }, [props.useless]); +const Progress = ({ data,theme, ...props }) => { return ( @@ -89,7 +83,7 @@ const Progress = ({ data, ...props }) => { { tw("h-full rounded-md"), { width: data.value + "%", - backgroundColor: Colors.theme1[colorScheme].greenCF, + backgroundColor: Colors.theme1[theme].greenCF, }, ]} > @@ -117,7 +111,9 @@ const Progress = ({ data, ...props }) => { ); }; -const mapStateToProps = (state) => ({}); +const mapStateToProps = (state) => ({ + theme: state.publicApi.theme +}); const mapDispatchToProps = { addVote: vote.add,