diff --git a/src/screens/DeliveryForm/Address/index.js b/src/screens/DeliveryForm/Address/index.js index 3e593be..045eb50 100644 --- a/src/screens/DeliveryForm/Address/index.js +++ b/src/screens/DeliveryForm/Address/index.js @@ -3,7 +3,6 @@ import { Text, Pressable, TouchableOpacity, - Appearance, ActivityIndicator, Platform } from "react-native"; @@ -19,8 +18,7 @@ import fontSize from "../../../constants/fontSize"; const ios = Platform.OS === "ios"; -const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) => { - const colorScheme = Appearance.getColorScheme(); +const Address = ({ addresses, update, userId, userAddressId, loading, mobile, theme }) => { const navigation = useNavigation(); const Location = ({ address, active }) => { @@ -30,13 +28,13 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) { backgroundColor: userAddressId === address?.id - ? Colors.theme1[colorScheme].greenCF + "15" - : Colors.theme1[colorScheme].grayE3 + "44", + ? Colors.theme1[theme].greenCF + "15" + : Colors.theme1[theme].grayE3 + "44", borderWidth: 1.5, borderColor: userAddressId === address?.id - ? Colors.theme1[colorScheme].greenCF - : Colors.theme1[colorScheme].grayE3, + ? Colors.theme1[theme].greenCF + : Colors.theme1[theme].grayE3, }, tw( `flex flex-row-reverse items-center w-full px-3 rounded-sm mt-2 ${mobile ? "py-2" : "py-4"}` @@ -51,7 +49,7 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) {loading && userAddressId !== address?.id ? ( ) : ( @@ -102,8 +100,8 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) یک آدرس جدید اضافه کنید @@ -125,7 +123,7 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) style={{ marginRight: 5, fontSize: mobile ? fontSize.xl : fontSize.xl4, - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, }} > + @@ -139,7 +137,8 @@ const mapStateToProps = (state) => ({ userId: state.user.status?.id, userAddressId: state.userFactor.info?.userAddressId, loading: state.userFactor.loading, - mobile: state.publicApi.mobile + mobile: state.publicApi.mobile, + theme: state.publicApi.theme }); const mapDispatchToProps = { diff --git a/src/screens/DeliveryForm/TransportDate/index.js b/src/screens/DeliveryForm/TransportDate/index.js index aeda022..5acf8b8 100644 --- a/src/screens/DeliveryForm/TransportDate/index.js +++ b/src/screens/DeliveryForm/TransportDate/index.js @@ -1,4 +1,4 @@ -import { View, Text, Pressable, Appearance, Platform } from "react-native"; +import { View, Text, Pressable, Platform } from "react-native"; import React, { useCallback, useState } from "react"; import { connect } from "react-redux"; @@ -9,8 +9,7 @@ import fontSize from "../../../constants/fontSize"; const ios = Platform.OS === "ios"; -const TransportDate = ({ transportDate, mobile }) => { - const colorScheme = Appearance.getColorScheme(); +const TransportDate = ({ transportDate, mobile, theme }) => { const [activeDate, setActiveDate] = useState(transportDate?.times[0]); const Time = useCallback(({ time, active }) => { @@ -20,12 +19,12 @@ const TransportDate = ({ transportDate, mobile }) => { tw(`flex flex-row-reverse justify-between items-center w-full px-3 ${mobile ? "py-3" : "py-2"} rounded-sm mt-3`), { backgroundColor: active - ? Colors.theme1[colorScheme].greenCF + "15" - : Colors.theme1[colorScheme].grayE3 + "44", + ? Colors.theme1[theme].greenCF + "15" + : Colors.theme1[theme].grayE3 + "44", borderWidth: 1.5, borderColor: active - ? Colors.theme1[colorScheme].greenCF - : Colors.theme1[colorScheme].grayE3, + ? Colors.theme1[theme].greenCF + : Colors.theme1[theme].grayE3, }, ]} onPress={() => setActiveDate(time)} @@ -35,8 +34,8 @@ const TransportDate = ({ transportDate, mobile }) => { fontFamily: "regular", fontSize: mobile ? fontSize.tiny : fontSize.xl, color: active - ? Colors.theme1[colorScheme].gray20 - : Colors.theme1[colorScheme].gray20, + ? Colors.theme1[theme].gray20 + : Colors.theme1[theme].gray20, }} > {time.time} @@ -58,8 +57,8 @@ const TransportDate = ({ transportDate, mobile }) => { fontFamily: "regular", fontSize: mobile ? fontSize.sm : fontSize.base, color: active - ? Colors.theme1[colorScheme].green20 - : Colors.theme1[colorScheme].gray20, + ? Colors.theme1[theme].green20 + : Colors.theme1[theme].gray20, }} > تکمیل ظرفیت @@ -74,7 +73,7 @@ const TransportDate = ({ transportDate, mobile }) => { style={{ fontSize: mobile ? fontSize.base : fontSize.xl2, fontFamily: "bold", - color: Colors.theme1[colorScheme].green79, + color: Colors.theme1[theme].green79, textAlign : ios ? "right" : "auto", }} > @@ -90,7 +89,8 @@ const TransportDate = ({ transportDate, mobile }) => { }; const mapStateToProps = (state) => ({ - mobile: state.publicApi.mobile + mobile: state.publicApi.mobile, + theme: state.publicApi.theme }); const mapDispatchToProps = {}; diff --git a/src/screens/DeliveryForm/TransportMethod/index.js b/src/screens/DeliveryForm/TransportMethod/index.js index 0f52ec9..5032c4d 100644 --- a/src/screens/DeliveryForm/TransportMethod/index.js +++ b/src/screens/DeliveryForm/TransportMethod/index.js @@ -2,14 +2,11 @@ import { View, Text, Pressable, - TouchableOpacity, - Appearance, ActivityIndicator, Platform, } from "react-native"; import React, { useEffect, useCallback } from "react"; import { connect } from "react-redux"; -import { useNavigation } from "@react-navigation/native"; import { transport } from "../../../redux/actions"; import separate from "../../../utils/separate"; @@ -28,8 +25,8 @@ const TransportMethod = ({ userId, loading, mobile, + theme }) => { - const colorScheme = Appearance.getColorScheme(); useEffect(() => { getList(); @@ -47,12 +44,12 @@ const TransportMethod = ({ ), { backgroundColor: active - ? Colors.theme1[colorScheme].greenCF + "15" - : Colors.theme1[colorScheme].grayE3 + "44", + ? Colors.theme1[theme].greenCF + "15" + : Colors.theme1[theme].grayE3 + "44", borderWidth: 1.5, borderColor: active - ? Colors.theme1[colorScheme].greenCF - : Colors.theme1[colorScheme].grayE3, + ? Colors.theme1[theme].greenCF + : Colors.theme1[theme].grayE3, }, ]} onPress={() => @@ -70,8 +67,8 @@ const TransportMethod = ({ size="small" color={ factorInfo?.transportId === method?.id - ? Colors.theme1[colorScheme].greenC8 - : Colors.theme1[colorScheme].gray20 + ? Colors.theme1[theme].greenC8 + : Colors.theme1[theme].gray20 } /> ) : ( @@ -80,8 +77,8 @@ const TransportMethod = ({ fontFamily: "regular", fontSize: mobile ? fontSize.tiny : fontSize.xl2, color: active - ? Colors.theme1[colorScheme].gray20 - : Colors.theme1[colorScheme].gray20, + ? Colors.theme1[theme].gray20 + : Colors.theme1[theme].gray20, }} > {method.name} @@ -103,8 +100,8 @@ const TransportMethod = ({ fontFamily: "regular", fontSize: mobile ? fontSize.base : fontSize.base, color: active - ? Colors.theme1[colorScheme].green20 - : Colors.theme1[colorScheme].gray20, + ? Colors.theme1[theme].green20 + : Colors.theme1[theme].gray20, }} > {separate(method.price) + " " + "تومان"} @@ -121,7 +118,7 @@ const TransportMethod = ({ style={{ fontSize: mobile ? fontSize.base : fontSize.xl, fontFamily: "bold", - color: Colors.theme1[colorScheme].green79, + color: Colors.theme1[theme].green79, textAlign: ios ? "right" : "auto", }} > @@ -146,6 +143,7 @@ const mapStateToProps = (state) => ({ userId: state.user.status?.id, loading: state.userFactor.loading, mobile: state.publicApi.mobile, + theme: state.publicApi.theme }); const mapDispatchToProps = { diff --git a/src/screens/DeliveryForm/index.js b/src/screens/DeliveryForm/index.js index 541095a..3274633 100644 --- a/src/screens/DeliveryForm/index.js +++ b/src/screens/DeliveryForm/index.js @@ -1,18 +1,14 @@ import { View, - Text, SafeAreaView, ScrollView, StyleSheet, StatusBar, Platform, - Dimensions, - Appearance, } from "react-native"; import React, { useEffect } from "react"; import { connect } from "react-redux"; import { userFactor, userAddress } from "../../redux/actions"; -import { useNavigation } from "@react-navigation/native"; import { asyncAwesomeAlert } from "../../utils/AsyncWrappers"; //components @@ -26,12 +22,8 @@ import CustomPressable from "../../components/Pressable"; //style import tw from "tailwind-rn"; import Colors from "../../constants/Colors"; -import fontSize from "../../constants/fontSize"; - -const DeliveryForm = ({ list, form, getList, getFactorInfo, userId, payFactor, factorInfo }) => { - const colorScheme = Appearance.getColorScheme(); - const navigation = useNavigation(); +const DeliveryForm = ({ list, form, getList, getFactorInfo, userId, payFactor, factorInfo, theme }) => { useEffect(() => { getFactorInfo({ userId }); getList(); @@ -71,7 +63,7 @@ const DeliveryForm = ({ list, form, getList, getFactorInfo, userId, payFactor, f ({ factorInfo: state.userFactor.info, userId: state.user.status?.id, list: state.userAddress.list, + theme: state.publicApi.theme }); const mapDispatchToProps = {