reza fixed product add to cart

master
Reza_ashrafi 2 years ago
parent 44f163e073
commit de907b9453
  1. 23
      src/screens/Product/components/Book.js
  2. 2
      src/screens/Product/components/Rates.js
  3. 2
      src/screens/Product/index.js

@ -55,31 +55,31 @@ function Book({
const physicalProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 2)[0];
});
},[book]);
const digitalProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 1)[0];
});
},[book]);
const videoProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 4)[0];
});
},[book]);
const physicalAvailabileInCart = React.useMemo(() => {
return userProducts?.filter(
(product) => product?.productId === book?.product[1]?.id
(product) => product?.productId === physicalProduct?.id
)[0];
}, [userProducts, book]);
const digitalAvailabileInCart = React.useMemo(() => {
return userProducts?.filter(
(product) => product?.productId === book?.product[0]?.id
(product) => product?.productId === digitalProduct?.id
)[0];
}, [userProducts, book]);
const videoAvailabileInCart = React.useMemo(() => {
return userProducts?.filter(
(product) => product?.productId === book?.product[2]?.id
(product) => product?.productId === videoProduct?.id
)[0];
}, [userProducts, book]);
@ -131,9 +131,9 @@ function Book({
}, [userProducts]);
return (
<ScrollView style={[tw("flex flex-1 relative")]}>
<View style={[tw("flex flex-1 relative")]}>
{!mobile ? <View style={tw("mt-5")}></View> : null}
{imageSlider ? <ImageSlider /> : null}
{/* {imageSlider ? <ImageSlider /> : null} */}
<View style={[tw("flex flex-row-reverse")]}>
<Image
source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }}
@ -180,7 +180,6 @@ function Book({
{"پایه" + " " + (grades[book?.gradeId] || " ")}
</Text>
</View>
</View>
</View>
<View
@ -609,7 +608,7 @@ function Book({
onPress={() =>
navigation.push("Info", {
type: { name: "توضیحات", value: "productDescription" },
data : book?.text
data: book?.text,
})
}
/>
@ -640,7 +639,7 @@ function Book({
onPress={() =>
navigation.push("Info", {
type: { name: "پرسش و پاسخ", value: "productQuestion" },
data: []
data: [],
})
}
/>
@ -671,7 +670,7 @@ function Book({
/>
</>
) : null}
</ScrollView>
</View>
);
}

@ -43,7 +43,7 @@ function Rates({ rate, productId, addVote, isBuyed = null, theme }) {
tintColor={
theme === "light" ? Colors.theme1.white : Colors.theme1.dark
}
value={4}
startingValue={rate}
onFinishRating={(rating) => addVote({ productId, vote: rating })}
readonly={!isBuyed}
/>

@ -6,6 +6,7 @@ import {
ScrollView,
SafeAreaView,
StatusBar,
KeyboardAvoidingView,
} from "react-native";
import Book from "./components/Book";
import { book } from "../../redux/actions";
@ -22,6 +23,7 @@ function Product({ route, book, getBook, grades }) {
style={{
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
position: "relative",
flex: 1,
}}
>
<Navbar

Loading…
Cancel
Save