diff --git a/src/screens/Profile/components/List.js b/src/screens/Profile/components/List.js index 94e815f..a0c96df 100644 --- a/src/screens/Profile/components/List.js +++ b/src/screens/Profile/components/List.js @@ -1,8 +1,6 @@ import { View, Text, - Image, - Appearance, Platform, TouchableOpacity, Dimensions, @@ -20,11 +18,9 @@ import fontSize from "../../../constants/fontSize"; import Colors from "../../../constants/Colors"; const ios = Platform.OS === "ios"; -const { height } = Dimensions.get("window"); -const List = ({ mobile }) => { +const List = ({ mobile, theme }) => { const navigation = useNavigation(); - const colorScheme = Appearance.getColorScheme(); const pages = [ { @@ -215,7 +211,7 @@ const List = ({ mobile }) => { ), { borderBottomWidth: 1, - borderColor: Colors.theme1[colorScheme].grayE3 + "aa", + borderColor: Colors.theme1[theme].grayE3 + "aa", }, ]} onPress={() => page.onPress()} @@ -227,7 +223,7 @@ const List = ({ mobile }) => { fontFamily: "regular", marginTop: 5, marginRight: mobile ? 10 : 20, - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, fontSize: mobile ? fontSize.tiny : fontSize.lg, }} > @@ -252,6 +248,7 @@ const List = ({ mobile }) => { const mapStateToProps = (state) => ({ mobile: state.publicApi.mobile, + theme: state.publicApi.theme }); export default connect(mapStateToProps)(List); diff --git a/src/screens/Profile/components/ProfileAddress/index.js b/src/screens/Profile/components/ProfileAddress/index.js index 146da39..0eb2843 100644 --- a/src/screens/Profile/components/ProfileAddress/index.js +++ b/src/screens/Profile/components/ProfileAddress/index.js @@ -3,8 +3,6 @@ import { Text, Pressable, TouchableOpacity, - Appearance, - ActivityIndicator, SafeAreaView, ScrollView, StyleSheet, @@ -28,7 +26,6 @@ import tw from "tailwind-rn"; import Colors from "../../../../constants/Colors"; import fontSize from "../../../../constants/fontSize"; -const { height, width } = Dimensions.get("window"); const ios = Platform.OS === "ios"; const ProfileAddress = ({ @@ -38,11 +35,9 @@ const ProfileAddress = ({ userId, userAddressId, getFactorInfo, - loading, - closeBottomSheet, mobile, + theme }) => { - const colorScheme = Appearance.getColorScheme(); const navigation = useNavigation(); const [height, setHeight] = React.useState(Dimensions.get("window").height); const Location = ({ address, active }) => { @@ -52,13 +47,13 @@ const ProfileAddress = ({ { backgroundColor: userAddressId === address?.id - ? Colors.theme1[colorScheme].greenCF + "0a" - : Colors.theme1[colorScheme].grayE3 + "44", + ? Colors.theme1[theme].greenCF + "0a" + : Colors.theme1[theme].grayE3 + "44", borderWidth: 2, borderColor: userAddressId === address?.id - ? Colors.theme1[colorScheme].greenCF + "aa" - : Colors.theme1[colorScheme].grayE3, + ? Colors.theme1[theme].greenCF + "aa" + : Colors.theme1[theme].grayE3, }, tw( `flex flex-row-reverse items-center w-full px-3 py-2 rounded-md mt-2` @@ -80,7 +75,7 @@ const ProfileAddress = ({ style={{ fontSize: fontSize.base, fontFamily: "bold", - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, }} > آدرس انتخابی شما @@ -89,7 +84,7 @@ const ProfileAddress = ({ style={{ fontSize: fontSize.xs, fontFamily: "regular", - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, marginRight: 10, }} > @@ -164,7 +159,7 @@ const ProfileAddress = ({ {!active && ( @@ -181,8 +176,8 @@ const ProfileAddress = ({ title={"مشاهده روی نقشه"} backgroundColor={ active - ? Colors.theme1[colorScheme].greenCF - : Colors.theme1[colorScheme].gray20 + "66" + ? Colors.theme1[theme].greenCF + : Colors.theme1[theme].gray20 + "66" } color={"white"} border={{ color: "#196EC0", width: 0 }} @@ -245,8 +240,8 @@ const ProfileAddress = ({ یک آدرس جدید اضافه کنید @@ -269,7 +264,7 @@ const ProfileAddress = ({ marginTop: 3, marginRight: 5, fontSize: fontSize.xl3, - color: Colors.theme1[colorScheme].greenCF, + color: Colors.theme1[theme].greenCF, fontFamily: "bold", }} > @@ -287,6 +282,7 @@ const mapStateToProps = (state) => ({ loading: state.userFactor.loading, addresses: state.userAddress.list, mobile: state.publicApi.mobile, + theme: state.publicApi.theme }); const mapDispatchToProps = { diff --git a/src/screens/Profile/components/ProfileBookmark/index.js b/src/screens/Profile/components/ProfileBookmark/index.js index 0907a72..8ba27a8 100644 --- a/src/screens/Profile/components/ProfileBookmark/index.js +++ b/src/screens/Profile/components/ProfileBookmark/index.js @@ -37,8 +37,8 @@ const ProfileBookmark = ({ loading, mobile, grades, + theme }) => { - const colorScheme = Appearance.getColorScheme(); React.useEffect(() => { getList(); @@ -71,7 +71,7 @@ const ProfileBookmark = ({ width: Dimensions.get("window").width, height: height, zIndex: 1, - backgroundColor: Colors.theme1[colorScheme].white + "60", + backgroundColor: Colors.theme1[theme].white + "60", }, ]} > @@ -92,6 +92,7 @@ const ProfileBookmark = ({ deleteItem={deleteItem} mobile={mobile} grades={grades} + theme={theme} /> ))} @@ -104,13 +105,9 @@ const ProfileBookmark = ({ ); }; -const Bookmark = ({ bookmark, deleteItem, mobile, grades }) => { +const Bookmark = ({ bookmark, deleteItem, mobile, grades, theme }) => { const navigation = useNavigation(); - const colorScheme = React.useMemo(() => { - return Appearance.getColorScheme(); - }, [bookmark]); - const isContent = React.useMemo(() => { return bookmark?.content; }, [bookmark]); @@ -121,7 +118,7 @@ const Bookmark = ({ bookmark, deleteItem, mobile, grades }) => { tw("flex flex-row-reverse rounded-md justify-between px-3.5 py-2 mb-4"), { borderWidth: 1.5, - borderColor: Colors.theme1[colorScheme].greenCF, + borderColor: Colors.theme1[theme].greenCF, }, ]} onPress={() => @@ -165,7 +162,7 @@ const Bookmark = ({ bookmark, deleteItem, mobile, grades }) => { style={{ fontFamily: "bold", fontSize: fontSize.tiny, - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, width: width / 3, }} > @@ -177,7 +174,7 @@ const Bookmark = ({ bookmark, deleteItem, mobile, grades }) => { marginTop: 5, fontFamily: "regular", fontSize: fontSize.base, - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, }} > {"پایه" + " " + grades[bookmark?.product?.book?.gradeId]} @@ -217,6 +214,7 @@ const mapStateToProps = (state) => ({ bookmarkList: state.userFavorite.list, loading: state.userFavorite.loading, grades: state.publicApi.grades, + theme: state.publicApi.theme }); const mapDispatchToProps = { diff --git a/src/screens/Profile/components/Trophy.js b/src/screens/Profile/components/Trophy.js index 8a133c1..08c5112 100644 --- a/src/screens/Profile/components/Trophy.js +++ b/src/screens/Profile/components/Trophy.js @@ -1,4 +1,4 @@ -import { View, Text, Appearance, Platform, Pressable } from "react-native"; +import { View, Text, Platform, Pressable } from "react-native"; import React from "react"; import { connect } from "react-redux"; import Svg, { G, Path } from "react-native-svg"; @@ -10,16 +10,14 @@ import Colors from "../../../constants/Colors"; const ios = Platform.OS === "ios"; -const Trophy = ({}) => { - const colorScheme = Appearance.getColorScheme(); - const [dropdown, setDropdown] = React.useState(true); +const Trophy = ({theme}) => { return ( @@ -57,7 +55,7 @@ const Trophy = ({}) => { fontFamily: "regular", fontSize: fontSize.tiny, marginRight: 10, - color: Colors.theme1[colorScheme].green79, + color: Colors.theme1[theme].green79, }} > {"امتیاز شما" + " " + 14560} @@ -68,7 +66,7 @@ const Trophy = ({}) => { style={{ fontFamily: "light", fontSize: fontSize.sm, - color: Colors.theme1[colorScheme].green79, + color: Colors.theme1[theme].green79, }} > مشاهده جوایز @@ -78,6 +76,8 @@ const Trophy = ({}) => { ); }; -const mapStateToProps = (state) => ({}); +const mapStateToProps = (state) => ({ + theme: state.publicApi.theme +}); export default connect(mapStateToProps)(Trophy); diff --git a/src/screens/Profile/components/User.js b/src/screens/Profile/components/User.js index 869c881..e177949 100644 --- a/src/screens/Profile/components/User.js +++ b/src/screens/Profile/components/User.js @@ -2,7 +2,6 @@ import { View, Text, Image, - Appearance, Platform, Pressable, } from "react-native"; @@ -17,8 +16,7 @@ import Colors from "../../../constants/Colors"; const ios = Platform.OS === "ios"; -const User = ({ user, mobile }) => { - const colorScheme = Appearance.getColorScheme(); +const User = ({ user, mobile, theme }) => { const [dropdown, setDropdown] = React.useState(true); return ( @@ -54,7 +52,7 @@ const User = ({ user, mobile }) => { @@ -63,7 +61,7 @@ const User = ({ user, mobile }) => { { tw(`flex items-center w-full pb-3 mb-3 flex-row-reverse`), { borderBottomWidth: 1, - borderColor: Colors.theme1[colorScheme].grayE3, + borderColor: Colors.theme1[theme].grayE3, }, ]} > @@ -106,7 +104,7 @@ const User = ({ user, mobile }) => { style={{ fontSize: mobile ? fontSize.base : fontSize.xl, fontFamily: "bold", - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, }} > افزودن حساب کاربری جدید @@ -117,7 +115,7 @@ const User = ({ user, mobile }) => { marginTop: 3, fontSize: fontSize.xl2, fontFamily: "bold", - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, }} > + @@ -132,6 +130,7 @@ const User = ({ user, mobile }) => { const mapStateToProps = (state) => ({ user: state.user.status, mobile: state.publicApi.mobile, + theme: state.publicApi.theme }); export default connect(mapStateToProps)(User);