diff --git a/navigation/index.js b/navigation/index.js index 056cf98..ed78303 100644 --- a/navigation/index.js +++ b/navigation/index.js @@ -59,13 +59,19 @@ const BottomTabNavigator = ({}) => { contentStyle: { backgroundColor: "white", }, - tabBarIconStyle: {}, + tabBarIconStyle: { + transform: [{ scaleX: -1 }], + + }, tabBarLabelPosition: "below-icon", - tabBarActiveTintColor: Colors.theme1['light'].green79, + tabBarActiveTintColor: Colors.theme1["light"].green79, tabBarInactiveTintColor: "grey", tabBarStyle: { - backgroundColor: Colors.theme1['light'].white, + backgroundColor: Colors.theme1["light"].white, + transform: [{ scaleX: -1 }], }, + + tabBarLabelStyle: { // fontSize: fontSize.sm, // fontFamily: "bold", @@ -74,108 +80,108 @@ const BottomTabNavigator = ({}) => { }} > focused ? ( - - - - + + ) : ( - - - - + /> + ), - contentStyle: { - backgroundColor: "white", - }, }} /> focused ? ( - + - - - + /> ) : ( - + ), }} /> + { { { data-name="Vector" d="M12.427 14.995v-2.083c0-2.673 1.892-3.766 4.2-2.43l1.805 1.042 1.806 1.041c2.308 1.336 2.308 3.523 0 4.86l-1.806 1.041-1.805 1.046c-2.308 1.332-4.2.239-4.2-2.434v-2.083Z" fill="none" - stroke={Colors.theme1['light'].green79} + stroke={Colors.theme1["light"].green79} strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} @@ -234,105 +240,107 @@ const BottomTabNavigator = ({}) => { }} /> focused ? ( - - + data-name="vuesax/linear/bag-2" + > + + + ) : ( - + ), }} /> + focused ? ( - - + + + + ) : ( - - + > + + + ), + contentStyle: { + backgroundColor: "white", + }, }} /> @@ -345,7 +353,7 @@ const HomeStackScreen = () => { @@ -370,7 +378,7 @@ const ProductsStackScreen = () => { @@ -389,7 +397,7 @@ const VODStackScreen = () => { @@ -406,7 +414,7 @@ const CARTStackScreen = () => { @@ -422,10 +430,12 @@ const PROFILEStackScreen = () => { + + ); }; @@ -441,10 +451,10 @@ const Navigation = ({ getStatus, isLogin, userProducts, ltr, setLTR }) => { const setDirection = async () => { setLTR(); await I18nManager.allowRTL(false); - } + }; useEffect(() => { - if(I18nManager.isRTL && !ltr){ + if (I18nManager.isRTL && !ltr) { setDirection(); Restart(); } @@ -457,7 +467,7 @@ const Navigation = ({ getStatus, isLogin, userProducts, ltr, setLTR }) => { // initialRouteName="Root" screenOptions={{ headerShown: false, - contentStyle: { backgroundColor: Colors.theme1['light'].white }, + contentStyle: { backgroundColor: Colors.theme1["light"].white }, }} > @@ -483,7 +493,6 @@ const Navigation = ({ getStatus, isLogin, userProducts, ltr, setLTR }) => { - @@ -493,8 +502,8 @@ const Navigation = ({ getStatus, isLogin, userProducts, ltr, setLTR }) => { const mapStateToProps = (state) => ({ isLogin: state.user.status, userProducts: state.userProduct.list, - theme : state.publicApi.theme, - ltr: state.publicApi.ltr + theme: state.publicApi.theme, + ltr: state.publicApi.ltr, }); const mapDispatchToProps = { getStatus: user.getStatus, diff --git a/src/redux/actions/userFavorite.js b/src/redux/actions/userFavorite.js index 943628d..f766d0c 100644 --- a/src/redux/actions/userFavorite.js +++ b/src/redux/actions/userFavorite.js @@ -16,13 +16,11 @@ const userFavorite = { (data = {}, data2 = {}, data3 = {}) => async (dispatch) => { await proxy.post("userFavorite/add", data, { dispatch }); - await proxy.get("userFavorite/list", data2, { dispatch }); }, del: (data = {}, data2 = {}) => async (dispatch) => { await proxy.delete("userFavorite/delete", data, { dispatch }); - await proxy.get("userFavorite/list", data2, { dispatch }); }, }; diff --git a/src/redux/proxy.js b/src/redux/proxy.js index 741325d..4db7985 100644 --- a/src/redux/proxy.js +++ b/src/redux/proxy.js @@ -66,14 +66,7 @@ class Proxy { let response = fetch(); dispatch({ type: url, data: response.data.data, params }); return response.data.data; - } - break; - case 403: - dispatch({ - type: url.split("/")[0] + "/" + "error", - // data: response.data, - // params, - }); + } return; default: dispatch({ diff --git a/src/redux/reducers/faq.js b/src/redux/reducers/faq.js index f970c59..0a3f5ff 100644 --- a/src/redux/reducers/faq.js +++ b/src/redux/reducers/faq.js @@ -3,7 +3,7 @@ const initialState = { error: null, list: [], searchResult: [], - search: null, + search: "", }; export default function faq(state = initialState, action) { diff --git a/src/redux/reducers/user.js b/src/redux/reducers/user.js index 4ec3de1..a3f9398 100644 --- a/src/redux/reducers/user.js +++ b/src/redux/reducers/user.js @@ -27,6 +27,7 @@ const user = (state = initialState, action) => { case "public/sendOTP": return { ...state, loading: false, error: null }; case "user/getStatus": + console.log(data.status); return { ...state, status: JSON.parse(data.status), error: null }; case "user/login": case "user/otp/login": @@ -62,10 +63,6 @@ const user = (state = initialState, action) => { case "user/loading": return { ...state, loading: true }; case "user/error": - console.log('hey'); - // asyncAwesomeAlert("خطا", data.message, { - // showCancelButton: false, - // }); return { ...state, error : true }; default: return state; diff --git a/src/redux/reducers/userFavorite.js b/src/redux/reducers/userFavorite.js index 5f10ccd..f437d50 100644 --- a/src/redux/reducers/userFavorite.js +++ b/src/redux/reducers/userFavorite.js @@ -19,10 +19,14 @@ export default function userFavorite(state = initialState, action) { case "userFavorite/update": return { ...state, loading: false, error: null }; case "userFavorite/add": - toastMessage("به لیست علاقه‌مندی‌ها اضافه شد."); - return { ...state, loading: false, error: null }; + return { + ...state, + list: data.userFavorites, + loading: false, + error: null, + }; case "userFavorite/delete": - return { ...state, loading: false, error: null }; + return { ...state, list : data.userFavorites, loading: false, error: null }; case "userFavorite/loading": return { ...state, loading: true }; case "userFavorite/error": diff --git a/src/screens/Faq/index.js b/src/screens/Faq/index.js index 8d0ea9d..1a2e5cc 100644 --- a/src/screens/Faq/index.js +++ b/src/screens/Faq/index.js @@ -7,6 +7,7 @@ import { Platform, StatusBar, Text, + FlatList, } from "react-native"; import { connect } from "react-redux"; import { faq } from "../../redux/actions"; @@ -28,10 +29,12 @@ const { width, height } = Dimensions.get("window"); function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq }) { useEffect(() => { - getFaq(); - }, []); + if (list.length === 0) { + getFaq(); + } + }, [list]); - return ( + return list.length > 0 ? ( - - {!search ? ( - list.length && - list.map((item, index) => ( - - )) - ) : list.length && searchResult.length ? ( - searchResult.map((item, index) => ( - - )) - ) : ( - - سوالی یافت نشد. - - )} - + {/* {search && searchResult.length !== 0 && ( + { + return index; + }} + renderItem={({ item }) => ( + + )} + /> + )} */} + {search ? ( + { + return index; + }} + renderItem={({ item }) => ( + + )} + initialNumToRender={10} + /> + ) : ( + { + return index; + }} + renderItem={({ item }) => ( + + )} + initialNumToRender={10} + /> + )} + {/* {search && searchResult.length === 0 && ( + + موردی یافت نشد. + + )} */} - ); + ) : null; } const mapStateToProps = (state) => ({ diff --git a/src/screens/Home/index.js b/src/screens/Home/index.js index 68ab7ed..30575ac 100644 --- a/src/screens/Home/index.js +++ b/src/screens/Home/index.js @@ -1,5 +1,7 @@ import React, { useState, useEffect } from "react"; import { connect } from "react-redux"; +import { asyncAwesomeAlert } from "../../utils/AsyncWrappers"; +import { useNavigation } from "@react-navigation/native"; import { View, StyleSheet, @@ -9,6 +11,7 @@ import { Platform, StatusBar, LayoutAnimation, + BackHandler, } from "react-native"; //components @@ -24,13 +27,9 @@ import Header from "./components/Header"; import tw from "tailwind-rn"; // Within your render function -const Home = ({ - blogs, - books, - userProducts, - mobile, -}) => { +const Home = ({ blogs, books, userProducts, mobile }) => { const [position, setPosition] = useState("100%"); + const navigation = useNavigation(); const setBoxPosition = () => { LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); @@ -38,40 +37,40 @@ const Home = ({ }; return ( - + + + - - - - {!mobile && } - - -
- - - - - - + {!mobile && } + + +
+ + + + + + ); }; @@ -98,7 +97,6 @@ const mapStateToProps = (state) => ({ }); const mapDispatchToProps = { - // getVideos: product.listVOD }; diff --git a/src/screens/Profile/components/ProfileBookmark/index.js b/src/screens/Profile/components/ProfileBookmark/index.js index 8ba27a8..f28339c 100644 --- a/src/screens/Profile/components/ProfileBookmark/index.js +++ b/src/screens/Profile/components/ProfileBookmark/index.js @@ -122,7 +122,7 @@ const Bookmark = ({ bookmark, deleteItem, mobile, grades, theme }) => { }, ]} onPress={() => - navigation.navigate(isContent ? "Blog" : "Product", { + navigation.push(isContent ? "Blog" : "Product", { id: isContent ? bookmark?.id : bookmark?.id, }) } diff --git a/src/screens/ShoppingCart/index.js b/src/screens/ShoppingCart/index.js index 5f1403e..04b2a2f 100644 --- a/src/screens/ShoppingCart/index.js +++ b/src/screens/ShoppingCart/index.js @@ -305,7 +305,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(ShoppingCart); const styles = StyleSheet.create({ contentContainerStyle: { - paddingBottom: 100, + paddingBottom: 50, position: "relative", }, container: { diff --git a/src/screens/Splash/index.js b/src/screens/Splash/index.js index 17122e6..7d6a277 100644 --- a/src/screens/Splash/index.js +++ b/src/screens/Splash/index.js @@ -38,13 +38,16 @@ function Splash({ } } } - }, [isLogin, userProducts, books, blogs]); + }, []); if(isFocused && out){ - console.log('from back button'); - // setOut(false); + setOut(false); BackHandler.exitApp(); } + + // if(isFocused){ + // console.log('bi rabt'); + // } if(isFocused && !out){ if (isLogin !== null) {