reza fixed add to cart button

master
Reza_ashrafi 2 years ago
parent e4e653118c
commit 86cde35622
  1. 23
      src/screens/Product/components/Book.js
  2. 64
      src/screens/Profile/components/List.js
  3. 4
      src/screens/Profile/components/ProfileAddress/index.js

@ -55,32 +55,37 @@ function Book({
const physicalProduct = React.useMemo(() => { const physicalProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 2)[0]; return book?.product?.filter((product) => product?.productType === 2)[0];
},[book]); }, [book]);
const digitalProduct = React.useMemo(() => { const digitalProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 1)[0]; return book?.product?.filter((product) => product?.productType === 1)[0];
},[book]); }, [book]);
const videoProduct = React.useMemo(() => { const videoProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 4)[0]; return book?.product?.filter((product) => product?.productType === 4)[0];
},[book]); }, [book]);
const physicalAvailabileInCart = React.useMemo(() => { const physicalAvailabileInCart = React.useMemo(() => {
return userProducts?.filter( return userProducts?.filter(
(product) => product?.productId === physicalProduct?.id (product) =>
)[0]; product?.productId === physicalProduct?.id && product?.condition < 2
)?.length;
}, [userProducts, book]); }, [userProducts, book]);
console.log(physicalAvailabileInCart);
const digitalAvailabileInCart = React.useMemo(() => { const digitalAvailabileInCart = React.useMemo(() => {
return userProducts?.filter( return userProducts?.filter(
(product) => product?.productId === digitalProduct?.id (product) =>
)[0]; product?.productId === digitalProduct?.id && product?.condition < 2
)?.length;
}, [userProducts, book]); }, [userProducts, book]);
const videoAvailabileInCart = React.useMemo(() => { const videoAvailabileInCart = React.useMemo(() => {
return userProducts?.filter( return userProducts?.filter(
(product) => product?.productId === videoProduct?.id (product) =>
)[0]; product?.productId === videoProduct?.id && product?.condition < 2
)?.length;
}, [userProducts, book]); }, [userProducts, book]);
const addToCart = React.useCallback( const addToCart = React.useCallback(

@ -121,38 +121,38 @@ const List = ({ mobile, theme }) => {
name: "کتابهای من", name: "کتابهای من",
onPress: () => navigation.push("AR"), onPress: () => navigation.push("AR"),
}, },
{ // {
icon: ( // icon: (
<Svg xmlns="http://www.w3.org/2000/svg" width={25.613} height={22.519}> // <Svg xmlns="http://www.w3.org/2000/svg" width={25.613} height={22.519}>
<G data-name="Group 2005"> // <G data-name="Group 2005">
<Path // <Path
d="M18.085 20.769H6.528c-3.467 0-5.778-2-5.778-6.673V7.423C.75 2.75 3.061.75 6.528.75h11.557c3.467 0 5.778 2 5.778 6.673v6.673c0 4.671-2.313 6.673-5.778 6.673Z" // d="M18.085 20.769H6.528c-3.467 0-5.778-2-5.778-6.673V7.423C.75 2.75 3.061.75 6.528.75h11.557c3.467 0 5.778 2 5.778 6.673v6.673c0 4.671-2.313 6.673-5.778 6.673Z"
fill="none" // fill="none"
stroke={ // stroke={
theme === "light" ? Colors.theme1.greenCF : Colors.theme1.white // theme === "light" ? Colors.theme1.greenCF : Colors.theme1.white
} // }
strokeLinecap="round" // strokeLinecap="round"
strokeLinejoin="round" // strokeLinejoin="round"
strokeWidth={1.5} // strokeWidth={1.5}
data-name="vuesax/linear/music-playlist" // data-name="vuesax/linear/music-playlist"
/> // />
<Path // <Path
data-name="Vector" // data-name="Vector"
d="M8.954 10.76V9.296c0-1.878 1.329-2.646 2.951-1.708l1.268.732 1.268.732c1.622.939 1.622 2.476 0 3.415l-1.267.732-1.268.732c-1.623.938-2.952.17-2.952-1.708V10.76Z" // d="M8.954 10.76V9.296c0-1.878 1.329-2.646 2.951-1.708l1.268.732 1.268.732c1.622.939 1.622 2.476 0 3.415l-1.267.732-1.268.732c-1.623.938-2.952.17-2.952-1.708V10.76Z"
fill="none" // fill="none"
stroke={ // stroke={
theme === "light" ? Colors.theme1.greenCF : Colors.theme1.white // theme === "light" ? Colors.theme1.greenCF : Colors.theme1.white
} // }
strokeLinecap="round" // strokeLinecap="round"
strokeLinejoin="round" // strokeLinejoin="round"
strokeWidth={1.5} // strokeWidth={1.5}
/> // />
</G> // </G>
</Svg> // </Svg>
), // ),
name: "دورههای ویدئویی", // name: "دورههای ویدئویی",
onPress: () => navigation.push("MyCourses"), // onPress: () => navigation.push("MyCourses"),
}, // },
{ {
icon: ( icon: (
<Svg xmlns="http://www.w3.org/2000/svg" width={25.5} height={25.5}> <Svg xmlns="http://www.w3.org/2000/svg" width={25.5} height={25.5}>

@ -310,7 +310,7 @@ const ProfileAddress = ({
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
position: "relative", position: "relative",
flex: 1, flex: 1,
paddingBottom: 20, paddingBottom : 20
}} }}
> >
<Navbar <Navbar
@ -405,7 +405,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(ProfileAddress);
const styles = StyleSheet.create({ const styles = StyleSheet.create({
contentContainerStyle: { contentContainerStyle: {
paddingBottom: height, paddingBottom: 100,
position: "relative", position: "relative",
}, },
container: { container: {

Loading…
Cancel
Save