reza added some kossher

master
Reza_ashrafi 3 years ago
parent 07fe2219a9
commit 2318ade15d
  1. 259
      navigation/index.js
  2. 2
      src/redux/actions/userFavorite.js
  3. 9
      src/redux/proxy.js
  4. 2
      src/redux/reducers/faq.js
  5. 5
      src/redux/reducers/user.js
  6. 10
      src/redux/reducers/userFavorite.js
  7. 83
      src/screens/Faq/index.js
  8. 76
      src/screens/Home/index.js
  9. 2
      src/screens/Profile/components/ProfileBookmark/index.js
  10. 2
      src/screens/ShoppingCart/index.js
  11. 9
      src/screens/Splash/index.js

@ -59,13 +59,19 @@ const BottomTabNavigator = ({}) => {
contentStyle: { contentStyle: {
backgroundColor: "white", backgroundColor: "white",
}, },
tabBarIconStyle: {}, tabBarIconStyle: {
transform: [{ scaleX: -1 }],
},
tabBarLabelPosition: "below-icon", tabBarLabelPosition: "below-icon",
tabBarActiveTintColor: Colors.theme1['light'].green79, tabBarActiveTintColor: Colors.theme1["light"].green79,
tabBarInactiveTintColor: "grey", tabBarInactiveTintColor: "grey",
tabBarStyle: { tabBarStyle: {
backgroundColor: Colors.theme1['light'].white, backgroundColor: Colors.theme1["light"].white,
transform: [{ scaleX: -1 }],
}, },
tabBarLabelStyle: { tabBarLabelStyle: {
// fontSize: fontSize.sm, // fontSize: fontSize.sm,
// fontFamily: "bold", // fontFamily: "bold",
@ -74,108 +80,108 @@ const BottomTabNavigator = ({}) => {
}} }}
> >
<Tab.Screen <Tab.Screen
name="ProfileTab" name="HomeTab"
component={PROFILEStackScreen} component={HomeStackScreen}
options={{ options={{
title: "پروفایل", title: "خانه",
tabBarIcon: ({ focused, color }) => tabBarIcon: ({ focused, color }) =>
focused ? ( focused ? (
<Svg <Svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width={31.192} width={33.58}
height={31.192} height={33.579}
> >
<G fill={Colors.theme1['light'].green79}> <Path
<Path d="M15.803 14.127a2.363 2.363 0 0 0-.429 0 5.777 5.777 0 1 1 .429 0Z" /> d="M12.62 3.974 5.079 9.85a6.658 6.658 0 0 0-2.281 4.645v10.368a5.912 5.912 0 0 0 5.89 5.9h16.2a5.909 5.909 0 0 0 5.89-5.89V14.691a6.609 6.609 0 0 0-2.518-4.827l-8.644-6.058a6.278 6.278 0 0 0-6.996.168Z"
<Path fill={Colors.theme1["light"].green79}
data-name="Vector" />
d="M9.306 18.923c-3.145 2.105-3.145 5.537 0 7.629a12.693 12.693 0 0 0 13.01 0c3.145-2.105 3.145-5.537 0-7.629a12.752 12.752 0 0 0-13.01 0Z" <Path
/> data-name="Vector"
</G> d="M16.79 25.471v-6.693"
fill="none"
stroke="#fff"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={1.5}
/>
</Svg> </Svg>
) : ( ) : (
<Svg <Svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width={31.192} width={33.58}
height={31.192} height={33.579}
> >
<G <Path
d="M12.62 3.974 5.079 9.85a6.658 6.658 0 0 0-2.281 4.645v10.368a5.912 5.912 0 0 0 5.89 5.9h16.2a5.909 5.909 0 0 0 5.89-5.89V14.691a6.609 6.609 0 0 0-2.518-4.827l-8.644-6.058a6.278 6.278 0 0 0-6.996.168Z"
fill="none" fill="none"
stroke={Colors.theme1['light'].green79} stroke={Colors.theme1["light"].green79}
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth={1.5} strokeWidth={1.5}
> />
<Path d="M15.803 14.127a2.363 2.363 0 0 0-.429 0 5.777 5.777 0 1 1 .429 0Z" /> <Path
<Path data-name="Vector"
data-name="Vector" d="M16.79 25.471v-6.693"
d="M9.306 18.923c-3.145 2.105-3.145 5.537 0 7.629a12.693 12.693 0 0 0 13.01 0c3.145-2.105 3.145-5.537 0-7.629a12.752 12.752 0 0 0-13.01 0Z" fill="none"
/> stroke={Colors.theme1["light"].green79}
</G> strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={1.5}
/>
</Svg> </Svg>
), ),
contentStyle: {
backgroundColor: "white",
},
}} }}
/> />
<Tab.Screen <Tab.Screen
name="ShoppingCartTab" name="ProductsTab"
component={CARTStackScreen} component={ProductsStackScreen}
options={{ options={{
// tabBarBadge: count, title: "کتابها",
// tabBarBadgeStyle: {
// color: "white",
// backgroundColor: Colors.theme1['light'].green79,
// fontSize: fontSize.sm,
// },
title: "سبد خرید",
tabBarIcon: ({ focused, color }) => tabBarIcon: ({ focused, color }) =>
focused ? ( focused ? (
<Svg <Svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width={31.017} width={35.135}
height={31.017} height={34.763}
> >
<G <Path
fill={Colors.theme1['light'].green79} d="M32.207 24.227V6.798a2.869 2.869 0 0 0-3.179-2.875h-.088a27.857 27.857 0 0 0-10.35 3.422l-.249.159a1.641 1.641 0 0 1-1.552 0l-.361-.216A27.72 27.72 0 0 0 6.09 3.909a2.864 2.864 0 0 0-3.162 2.874v17.444a2.981 2.981 0 0 0 2.547 2.859l.425.058a37.976 37.976 0 0 1 10.892 3.524l.059.029a1.6 1.6 0 0 0 1.405 0 37.631 37.631 0 0 1 10.921-3.552l.483-.058a2.981 2.981 0 0 0 2.547-2.86Z"
stroke={"white"} fill={Colors.theme1["light"].green79}
/>
<Path
data-name="Vector"
d="M17.567 8.851v20.774M29.213 12.298h-3.294M29.159 16.643h-4.392"
fill="none"
stroke="#fff"
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth={1.5} strokeWidth={1.5}
data-name="vuesax/linear/bag-2" />
>
<Path d="M9.693 9.912V8.659a6.168 6.168 0 0 1 5.247-6.036 5.816 5.816 0 0 1 6.384 5.79v1.782" />
<Path
data-name="Vector"
d="M11.631 28.433h7.754c5.2 0 6.126-2.081 6.4-4.614l.969-7.754c.345-3.154-.555-5.726-6.076-5.726H10.339c-5.519 0-6.423 2.572-6.074 5.725l.969 7.754c.271 2.534 1.202 4.615 6.397 4.615ZM20.027 15.509h.011M10.979 15.509h.011"
/>
</G>
</Svg> </Svg>
) : ( ) : (
<Svg <Svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width={31.017} width={35.135}
height={31.017} height={34.763}
> >
<G <G
fill="none" fill="none"
stroke={Colors.theme1['light'].green79} stroke={Colors.theme1["light"].green79}
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth={1.5} strokeWidth={1.5}
data-name="vuesax/linear/bag-2"
> >
<Path d="M9.693 9.912V8.659a6.168 6.168 0 0 1 5.247-6.036 5.816 5.816 0 0 1 6.384 5.79v1.782" /> <Path d="M32.207 24.227V6.798a2.869 2.869 0 0 0-3.179-2.875h-.088a27.857 27.857 0 0 0-10.35 3.422l-.249.159a1.641 1.641 0 0 1-1.552 0l-.361-.216A27.72 27.72 0 0 0 6.09 3.909a2.864 2.864 0 0 0-3.162 2.874v17.444a2.981 2.981 0 0 0 2.547 2.859l.425.058a37.976 37.976 0 0 1 10.892 3.524l.059.029a1.6 1.6 0 0 0 1.405 0 37.631 37.631 0 0 1 10.921-3.552l.483-.058a2.981 2.981 0 0 0 2.547-2.86Z" />
<Path <Path
data-name="Vector" data-name="Vector"
d="M11.631 28.433h7.754c5.2 0 6.126-2.081 6.4-4.614l.969-7.754c.345-3.154-.555-5.726-6.076-5.726H10.339c-5.519 0-6.423 2.572-6.074 5.725l.969 7.754c.271 2.534 1.202 4.615 6.397 4.615ZM20.027 15.509h.011M10.979 15.509h.011" d="M17.567 7.666v21.959M29.213 12.298h-3.294M29.159 16.643h-4.392"
/> />
</G> </G>
</Svg> </Svg>
), ),
}} }}
/> />
<Tab.Screen <Tab.Screen
name="VODTab" name="VODTab"
component={VODStackScreen} component={VODStackScreen}
@ -189,8 +195,8 @@ const BottomTabNavigator = ({}) => {
<G data-name="Group 2000"> <G data-name="Group 2000">
<Path <Path
d="M25.421 29.241H8.974C4.04 29.241.75 26.392.75 19.744V10.25c0-6.651 3.29-9.5 8.224-9.5h16.447c4.935 0 8.229 2.849 8.229 9.5v9.5c0 6.642-3.294 9.491-8.229 9.491Z" d="M25.421 29.241H8.974C4.04 29.241.75 26.392.75 19.744V10.25c0-6.651 3.29-9.5 8.224-9.5h16.447c4.935 0 8.229 2.849 8.229 9.5v9.5c0 6.642-3.294 9.491-8.229 9.491Z"
fill={Colors.theme1['light'].green79} fill={Colors.theme1["light"].green79}
stroke={Colors.theme1['light'].green79} stroke={Colors.theme1["light"].green79}
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth={1.5} strokeWidth={1.5}
@ -213,7 +219,7 @@ const BottomTabNavigator = ({}) => {
<Path <Path
d="M25.421 29.241H8.974C4.04 29.241.75 26.392.75 19.744V10.25c0-6.651 3.29-9.5 8.224-9.5h16.447c4.935 0 8.229 2.849 8.229 9.5v9.5c0 6.642-3.294 9.491-8.229 9.491Z" d="M25.421 29.241H8.974C4.04 29.241.75 26.392.75 19.744V10.25c0-6.651 3.29-9.5 8.224-9.5h16.447c4.935 0 8.229 2.849 8.229 9.5v9.5c0 6.642-3.294 9.491-8.229 9.491Z"
fill="none" fill="none"
stroke={Colors.theme1['light'].green79} stroke={Colors.theme1["light"].green79}
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth={1.5} strokeWidth={1.5}
@ -223,7 +229,7 @@ const BottomTabNavigator = ({}) => {
data-name="Vector" 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" 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" fill="none"
stroke={Colors.theme1['light'].green79} stroke={Colors.theme1["light"].green79}
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth={1.5} strokeWidth={1.5}
@ -234,105 +240,107 @@ const BottomTabNavigator = ({}) => {
}} }}
/> />
<Tab.Screen <Tab.Screen
name="ProductsTab" name="ShoppingCartTab"
component={ProductsStackScreen} component={CARTStackScreen}
options={{ options={{
title: "کتابها", // tabBarBadge: count,
// tabBarBadgeStyle: {
// color: "white",
// backgroundColor: Colors.theme1['light'].green79,
// fontSize: fontSize.sm,
// },
title: "سبد خرید",
tabBarIcon: ({ focused, color }) => tabBarIcon: ({ focused, color }) =>
focused ? ( focused ? (
<Svg <Svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width={35.135} width={31.017}
height={34.763} height={31.017}
> >
<Path <G
d="M32.207 24.227V6.798a2.869 2.869 0 0 0-3.179-2.875h-.088a27.857 27.857 0 0 0-10.35 3.422l-.249.159a1.641 1.641 0 0 1-1.552 0l-.361-.216A27.72 27.72 0 0 0 6.09 3.909a2.864 2.864 0 0 0-3.162 2.874v17.444a2.981 2.981 0 0 0 2.547 2.859l.425.058a37.976 37.976 0 0 1 10.892 3.524l.059.029a1.6 1.6 0 0 0 1.405 0 37.631 37.631 0 0 1 10.921-3.552l.483-.058a2.981 2.981 0 0 0 2.547-2.86Z" fill={Colors.theme1["light"].green79}
fill={Colors.theme1['light'].green79} stroke={"white"}
/>
<Path
data-name="Vector"
d="M17.567 8.851v20.774M29.213 12.298h-3.294M29.159 16.643h-4.392"
fill="none"
stroke="#fff"
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth={1.5} strokeWidth={1.5}
/> data-name="vuesax/linear/bag-2"
>
<Path d="M9.693 9.912V8.659a6.168 6.168 0 0 1 5.247-6.036 5.816 5.816 0 0 1 6.384 5.79v1.782" />
<Path
data-name="Vector"
d="M11.631 28.433h7.754c5.2 0 6.126-2.081 6.4-4.614l.969-7.754c.345-3.154-.555-5.726-6.076-5.726H10.339c-5.519 0-6.423 2.572-6.074 5.725l.969 7.754c.271 2.534 1.202 4.615 6.397 4.615ZM20.027 15.509h.011M10.979 15.509h.011"
/>
</G>
</Svg> </Svg>
) : ( ) : (
<Svg <Svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width={35.135} width={31.017}
height={34.763} height={31.017}
> >
<G <G
fill="none" fill="none"
stroke={Colors.theme1['light'].green79} stroke={Colors.theme1["light"].green79}
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth={1.5} strokeWidth={1.5}
data-name="vuesax/linear/bag-2"
> >
<Path d="M32.207 24.227V6.798a2.869 2.869 0 0 0-3.179-2.875h-.088a27.857 27.857 0 0 0-10.35 3.422l-.249.159a1.641 1.641 0 0 1-1.552 0l-.361-.216A27.72 27.72 0 0 0 6.09 3.909a2.864 2.864 0 0 0-3.162 2.874v17.444a2.981 2.981 0 0 0 2.547 2.859l.425.058a37.976 37.976 0 0 1 10.892 3.524l.059.029a1.6 1.6 0 0 0 1.405 0 37.631 37.631 0 0 1 10.921-3.552l.483-.058a2.981 2.981 0 0 0 2.547-2.86Z" /> <Path d="M9.693 9.912V8.659a6.168 6.168 0 0 1 5.247-6.036 5.816 5.816 0 0 1 6.384 5.79v1.782" />
<Path <Path
data-name="Vector" data-name="Vector"
d="M17.567 7.666v21.959M29.213 12.298h-3.294M29.159 16.643h-4.392" d="M11.631 28.433h7.754c5.2 0 6.126-2.081 6.4-4.614l.969-7.754c.345-3.154-.555-5.726-6.076-5.726H10.339c-5.519 0-6.423 2.572-6.074 5.725l.969 7.754c.271 2.534 1.202 4.615 6.397 4.615ZM20.027 15.509h.011M10.979 15.509h.011"
/> />
</G> </G>
</Svg> </Svg>
), ),
}} }}
/> />
<Tab.Screen <Tab.Screen
name="HomeTab" name="ProfileTab"
component={HomeStackScreen} component={PROFILEStackScreen}
options={{ options={{
title: "خانه", title: "پروفایل",
tabBarIcon: ({ focused, color }) => tabBarIcon: ({ focused, color }) =>
focused ? ( focused ? (
<Svg <Svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width={33.58} width={31.192}
height={33.579} height={31.192}
> >
<Path <G fill={Colors.theme1["light"].green79}>
d="M12.62 3.974 5.079 9.85a6.658 6.658 0 0 0-2.281 4.645v10.368a5.912 5.912 0 0 0 5.89 5.9h16.2a5.909 5.909 0 0 0 5.89-5.89V14.691a6.609 6.609 0 0 0-2.518-4.827l-8.644-6.058a6.278 6.278 0 0 0-6.996.168Z" <Path d="M15.803 14.127a2.363 2.363 0 0 0-.429 0 5.777 5.777 0 1 1 .429 0Z" />
fill={Colors.theme1['light'].green79} <Path
/> data-name="Vector"
<Path d="M9.306 18.923c-3.145 2.105-3.145 5.537 0 7.629a12.693 12.693 0 0 0 13.01 0c3.145-2.105 3.145-5.537 0-7.629a12.752 12.752 0 0 0-13.01 0Z"
data-name="Vector" />
d="M16.79 25.471v-6.693" </G>
fill="none"
stroke="#fff"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={1.5}
/>
</Svg> </Svg>
) : ( ) : (
<Svg <Svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width={33.58} width={31.192}
height={33.579} height={31.192}
> >
<Path <G
d="M12.62 3.974 5.079 9.85a6.658 6.658 0 0 0-2.281 4.645v10.368a5.912 5.912 0 0 0 5.89 5.9h16.2a5.909 5.909 0 0 0 5.89-5.89V14.691a6.609 6.609 0 0 0-2.518-4.827l-8.644-6.058a6.278 6.278 0 0 0-6.996.168Z"
fill="none"
stroke={Colors.theme1['light'].green79}
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={1.5}
/>
<Path
data-name="Vector"
d="M16.79 25.471v-6.693"
fill="none" fill="none"
stroke={Colors.theme1['light'].green79} stroke={Colors.theme1["light"].green79}
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth={1.5} strokeWidth={1.5}
/> >
<Path d="M15.803 14.127a2.363 2.363 0 0 0-.429 0 5.777 5.777 0 1 1 .429 0Z" />
<Path
data-name="Vector"
d="M9.306 18.923c-3.145 2.105-3.145 5.537 0 7.629a12.693 12.693 0 0 0 13.01 0c3.145-2.105 3.145-5.537 0-7.629a12.752 12.752 0 0 0-13.01 0Z"
/>
</G>
</Svg> </Svg>
), ),
contentStyle: {
backgroundColor: "white",
},
}} }}
/> />
</Tab.Navigator> </Tab.Navigator>
@ -345,7 +353,7 @@ const HomeStackScreen = () => {
<HomeStack.Navigator <HomeStack.Navigator
screenOptions={{ screenOptions={{
headerShown: false, headerShown: false,
contentStyle: { backgroundColor: Colors.theme1['light'].white }, contentStyle: { backgroundColor: Colors.theme1["light"].white },
}} }}
initialRouteName="Home" initialRouteName="Home"
> >
@ -370,7 +378,7 @@ const ProductsStackScreen = () => {
<ProductsStack.Navigator <ProductsStack.Navigator
screenOptions={{ screenOptions={{
headerShown: false, headerShown: false,
contentStyle: { backgroundColor: Colors.theme1['light'].white }, contentStyle: { backgroundColor: Colors.theme1["light"].white },
}} }}
initialRouteName="Products" initialRouteName="Products"
> >
@ -389,7 +397,7 @@ const VODStackScreen = () => {
<VODStack.Navigator <VODStack.Navigator
screenOptions={{ screenOptions={{
headerShown: false, headerShown: false,
contentStyle: { backgroundColor: Colors.theme1['light'].white }, contentStyle: { backgroundColor: Colors.theme1["light"].white },
}} }}
> >
<VODStack.Screen name="VOD" component={Videos} /> <VODStack.Screen name="VOD" component={Videos} />
@ -406,7 +414,7 @@ const CARTStackScreen = () => {
<CARTStack.Navigator <CARTStack.Navigator
screenOptions={{ screenOptions={{
headerShown: false, headerShown: false,
contentStyle: { backgroundColor: Colors.theme1['light'].white }, contentStyle: { backgroundColor: Colors.theme1["light"].white },
}} }}
> >
<CARTStack.Screen name="ShoppingCart" component={ShoppingCart} /> <CARTStack.Screen name="ShoppingCart" component={ShoppingCart} />
@ -422,10 +430,12 @@ const PROFILEStackScreen = () => {
<PROFILEStack.Navigator <PROFILEStack.Navigator
screenOptions={{ screenOptions={{
headerShown: false, headerShown: false,
contentStyle: { backgroundColor: Colors.theme1['light'].white }, contentStyle: { backgroundColor: Colors.theme1["light"].white },
}} }}
> >
<PROFILEStack.Screen name="Profile" component={Profile} /> <PROFILEStack.Screen name="Profile" component={Profile} />
<PROFILEStack.Screen name="ProfileBookmark" component={ProfileBookmark} />
<PROFILEStack.Screen name="Product" component={Product} />
</PROFILEStack.Navigator> </PROFILEStack.Navigator>
); );
}; };
@ -441,10 +451,10 @@ const Navigation = ({ getStatus, isLogin, userProducts, ltr, setLTR }) => {
const setDirection = async () => { const setDirection = async () => {
setLTR(); setLTR();
await I18nManager.allowRTL(false); await I18nManager.allowRTL(false);
} };
useEffect(() => { useEffect(() => {
if(I18nManager.isRTL && !ltr){ if (I18nManager.isRTL && !ltr) {
setDirection(); setDirection();
Restart(); Restart();
} }
@ -457,7 +467,7 @@ const Navigation = ({ getStatus, isLogin, userProducts, ltr, setLTR }) => {
// initialRouteName="Root" // initialRouteName="Root"
screenOptions={{ screenOptions={{
headerShown: false, headerShown: false,
contentStyle: { backgroundColor: Colors.theme1['light'].white }, contentStyle: { backgroundColor: Colors.theme1["light"].white },
}} }}
> >
<Stack.Screen name="Splash" component={Splash} /> <Stack.Screen name="Splash" component={Splash} />
@ -483,7 +493,6 @@ const Navigation = ({ getStatus, isLogin, userProducts, ltr, setLTR }) => {
<Stack.Screen name="AR" component={AR} /> <Stack.Screen name="AR" component={AR} />
<Stack.Screen name="CreateAddress" component={Address} /> <Stack.Screen name="CreateAddress" component={Address} />
<Stack.Screen name="ProfileAddress" component={ProfileAddress} /> <Stack.Screen name="ProfileAddress" component={ProfileAddress} />
<Stack.Screen name="ProfileBookmark" component={ProfileBookmark} />
<Stack.Screen name="Info" component={Info} /> <Stack.Screen name="Info" component={Info} />
</Stack.Navigator> </Stack.Navigator>
</NavigationContainer> </NavigationContainer>
@ -493,8 +502,8 @@ const Navigation = ({ getStatus, isLogin, userProducts, ltr, setLTR }) => {
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
isLogin: state.user.status, isLogin: state.user.status,
userProducts: state.userProduct.list, userProducts: state.userProduct.list,
theme : state.publicApi.theme, theme: state.publicApi.theme,
ltr: state.publicApi.ltr ltr: state.publicApi.ltr,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
getStatus: user.getStatus, getStatus: user.getStatus,

@ -16,13 +16,11 @@ const userFavorite = {
(data = {}, data2 = {}, data3 = {}) => (data = {}, data2 = {}, data3 = {}) =>
async (dispatch) => { async (dispatch) => {
await proxy.post("userFavorite/add", data, { dispatch }); await proxy.post("userFavorite/add", data, { dispatch });
await proxy.get("userFavorite/list", data2, { dispatch });
}, },
del: del:
(data = {}, data2 = {}) => (data = {}, data2 = {}) =>
async (dispatch) => { async (dispatch) => {
await proxy.delete("userFavorite/delete", data, { dispatch }); await proxy.delete("userFavorite/delete", data, { dispatch });
await proxy.get("userFavorite/list", data2, { dispatch });
}, },
}; };

@ -66,14 +66,7 @@ class Proxy {
let response = fetch(); let response = fetch();
dispatch({ type: url, data: response.data.data, params }); dispatch({ type: url, data: response.data.data, params });
return response.data.data; return response.data.data;
} }
break;
case 403:
dispatch({
type: url.split("/")[0] + "/" + "error",
// data: response.data,
// params,
});
return; return;
default: default:
dispatch({ dispatch({

@ -3,7 +3,7 @@ const initialState = {
error: null, error: null,
list: [], list: [],
searchResult: [], searchResult: [],
search: null, search: "",
}; };
export default function faq(state = initialState, action) { export default function faq(state = initialState, action) {

@ -27,6 +27,7 @@ const user = (state = initialState, action) => {
case "public/sendOTP": case "public/sendOTP":
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
case "user/getStatus": case "user/getStatus":
console.log(data.status);
return { ...state, status: JSON.parse(data.status), error: null }; return { ...state, status: JSON.parse(data.status), error: null };
case "user/login": case "user/login":
case "user/otp/login": case "user/otp/login":
@ -62,10 +63,6 @@ const user = (state = initialState, action) => {
case "user/loading": case "user/loading":
return { ...state, loading: true }; return { ...state, loading: true };
case "user/error": case "user/error":
console.log('hey');
// asyncAwesomeAlert("خطا", data.message, {
// showCancelButton: false,
// });
return { ...state, error : true }; return { ...state, error : true };
default: default:
return state; return state;

@ -19,10 +19,14 @@ export default function userFavorite(state = initialState, action) {
case "userFavorite/update": case "userFavorite/update":
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
case "userFavorite/add": case "userFavorite/add":
toastMessage("به لیست علاقهمندیها اضافه شد."); return {
return { ...state, loading: false, error: null }; ...state,
list: data.userFavorites,
loading: false,
error: null,
};
case "userFavorite/delete": case "userFavorite/delete":
return { ...state, loading: false, error: null }; return { ...state, list : data.userFavorites, loading: false, error: null };
case "userFavorite/loading": case "userFavorite/loading":
return { ...state, loading: true }; return { ...state, loading: true };
case "userFavorite/error": case "userFavorite/error":

@ -7,6 +7,7 @@ import {
Platform, Platform,
StatusBar, StatusBar,
Text, Text,
FlatList,
} from "react-native"; } from "react-native";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { faq } from "../../redux/actions"; import { faq } from "../../redux/actions";
@ -28,10 +29,12 @@ const { width, height } = Dimensions.get("window");
function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq }) { function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq }) {
useEffect(() => { useEffect(() => {
getFaq(); if (list.length === 0) {
}, []); getFaq();
}
}, [list]);
return ( return list.length > 0 ? (
<SafeAreaView <SafeAreaView
style={{ style={{
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
@ -44,7 +47,7 @@ function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq }) {
logo: false, logo: false,
menu: false, menu: false,
hamburgerMenu: false, hamburgerMenu: false,
title: "", title: null,
bookmark: false, bookmark: false,
qr: true, qr: true,
back: true, back: true,
@ -64,32 +67,54 @@ function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq }) {
placeholder={"بخشی از پرسش خود را اینجا بنویسید"} placeholder={"بخشی از پرسش خود را اینجا بنویسید"}
/> />
</View> </View>
<ScrollView {/* {search && searchResult.length !== 0 && (
style={[tw("bg-white flex px-4 mb-4")]} <FlatList
contentContainerStyle={{ paddingBottom: height / 2.4 }} style={[tw("bg-white flex px-4 mb-4")]}
> data={searchResult}
{!search ? ( keyExtractor={(item, index) => {
list.length && return index;
list.map((item, index) => ( }}
<Instance key={index} question={item} selectFaq={selectFaq} /> renderItem={({ item }) => (
)) <Instance question={item} selectFaq={selectFaq} />
) : list.length && searchResult.length ? ( )}
searchResult.map((item, index) => ( />
<Instance key={index} question={item} selectFaq={selectFaq} /> )} */}
)) {search ? (
) : ( <FlatList
<Text contentContainerStyle={{ paddingBottom: height / 2 }}
style={[ style={[tw("bg-white flex px-4 mb-4")]}
tw("w-full text-center mt-10"), data={searchResult}
{ fontFamily: "regular", fontSize: width / 24 }, keyExtractor={(item, index) => {
]} return index;
> }}
سوالی یافت نشد. renderItem={({ item }) => (
</Text> <Instance question={item} selectFaq={selectFaq} />
)} )}
</ScrollView> initialNumToRender={10}
/>
) : (
<FlatList
contentContainerStyle={{ paddingBottom: height / 2 }}
style={[tw("bg-white flex px-4 mb-4")]}
data={list}
keyExtractor={(item, index) => {
return index;
}}
renderItem={({ item }) => (
<Instance question={item} selectFaq={selectFaq} />
)}
initialNumToRender={10}
/>
)}
{/* {search && searchResult.length === 0 && (
<Text
style={[tw("w-full px-4 mt-10 text-center"), { fontFamily: "bold" }]}
>
موردی یافت نشد.
</Text>
)} */}
</SafeAreaView> </SafeAreaView>
); ) : null;
} }
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({

@ -1,5 +1,7 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { asyncAwesomeAlert } from "../../utils/AsyncWrappers";
import { useNavigation } from "@react-navigation/native";
import { import {
View, View,
StyleSheet, StyleSheet,
@ -9,6 +11,7 @@ import {
Platform, Platform,
StatusBar, StatusBar,
LayoutAnimation, LayoutAnimation,
BackHandler,
} from "react-native"; } from "react-native";
//components //components
@ -24,13 +27,9 @@ import Header from "./components/Header";
import tw from "tailwind-rn"; import tw from "tailwind-rn";
// Within your render function // Within your render function
const Home = ({ const Home = ({ blogs, books, userProducts, mobile }) => {
blogs,
books,
userProducts,
mobile,
}) => {
const [position, setPosition] = useState("100%"); const [position, setPosition] = useState("100%");
const navigation = useNavigation();
const setBoxPosition = () => { const setBoxPosition = () => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
@ -38,40 +37,40 @@ const Home = ({
}; };
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
position: "relative", position: "relative",
flex : 1, flex: 1,
}}
>
<Navbar
setBoxPosition={setBoxPosition}
headerOptions={{
logo: true,
menu: false,
hamburgerMenu: true,
title: "",
bookmark: false,
qr: true,
back: false,
}} }}
/>
<Drawer setBoxPosition={setBoxPosition} position={position} />
<ScrollView
contentContainerStyle={styles.contentContainerStyle}
style={[styles.container]}
> >
<Navbar {!mobile && <View style={tw("mt-5")}></View>}
setBoxPosition={setBoxPosition} <MyBooks books={userProducts} />
headerOptions={{ <View style={tw("px-4 w-full")}>
logo: true, <Header title={"فروشگاه"} route={"Products"} />
menu: false, </View>
hamburgerMenu: true, <Scroll books={books} />
title: "", <Videos videos={books} />
bookmark: false, <Blogs blogs={blogs} />
qr: true, </ScrollView>
back: false, </SafeAreaView>
}}
/>
<Drawer setBoxPosition={setBoxPosition} position={position} />
<ScrollView
contentContainerStyle={styles.contentContainerStyle}
style={[styles.container]}
>
{!mobile && <View style={tw("mt-5")}></View>}
<MyBooks books={userProducts} />
<View style={tw("px-4 w-full")}>
<Header title={"فروشگاه"} route={"Products"} />
</View>
<Scroll books={books} />
<Videos videos={books} />
<Blogs blogs={blogs} />
</ScrollView>
</SafeAreaView>
); );
}; };
@ -98,7 +97,6 @@ const mapStateToProps = (state) => ({
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
// getVideos: product.listVOD // getVideos: product.listVOD
}; };

@ -122,7 +122,7 @@ const Bookmark = ({ bookmark, deleteItem, mobile, grades, theme }) => {
}, },
]} ]}
onPress={() => onPress={() =>
navigation.navigate(isContent ? "Blog" : "Product", { navigation.push(isContent ? "Blog" : "Product", {
id: isContent ? bookmark?.id : bookmark?.id, id: isContent ? bookmark?.id : bookmark?.id,
}) })
} }

@ -305,7 +305,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(ShoppingCart);
const styles = StyleSheet.create({ const styles = StyleSheet.create({
contentContainerStyle: { contentContainerStyle: {
paddingBottom: 100, paddingBottom: 50,
position: "relative", position: "relative",
}, },
container: { container: {

@ -38,13 +38,16 @@ function Splash({
} }
} }
} }
}, [isLogin, userProducts, books, blogs]); }, []);
if(isFocused && out){ if(isFocused && out){
console.log('from back button'); setOut(false);
// setOut(false);
BackHandler.exitApp(); BackHandler.exitApp();
} }
// if(isFocused){
// console.log('bi rabt');
// }
if(isFocused && !out){ if(isFocused && !out){
if (isLogin !== null) { if (isLogin !== null) {

Loading…
Cancel
Save