diff --git a/src/screens/Product/components/Book.js b/src/screens/Product/components/Book.js
index 13c8dfc..9acb663 100644
--- a/src/screens/Product/components/Book.js
+++ b/src/screens/Product/components/Book.js
@@ -92,7 +92,7 @@ function Book({
);
React.useEffect(() => {
- if (userProducts.length && whichTypeAdded) {
+ if (userProducts?.length && whichTypeAdded) {
setTimeout(() => {
if (whichTypeAdded === "video" && videoAvailabileInCart) {
asyncAwesomeAlert("", "به سبد خرید اضافه شد", {
@@ -644,7 +644,7 @@ function Book({
})
}
/>
- {product.rate || 4 ? (
+ {product?.rate || 4 ? (
<>
{
- if (!orderFullList.length) {
+ if (!orderFullList?.length) {
getFullList();
}
}, []);
@@ -48,7 +48,7 @@ function Commnets({
style={{ marginTop: 20, paddingBottom: 10 }}
data={comments}
renderItem={({ item }) => }
- keyExtractor={(item) => item.id}
+ keyExtractor={(item) => item?.id}
/>
@@ -66,7 +66,7 @@ const Comment = ({ comment, theme }) => {
{
,
]}
>
- {comment.name}
+ {comment?.name}
@@ -118,7 +118,7 @@ const Comment = ({ comment, theme }) => {
tw("mt-2"),
]}
>
- {comment.message}
+ {comment?.message}
);
@@ -160,7 +160,7 @@ const AddComment = ({ addComment, productId, theme, ...props }) => {
height: fontSize.base + 30,
},
]}
- value={comment.title}
+ value={comment?.title}
placeholder="عنوان نظر ..."
onChangeText={(text) => setCommentForm({ ...commentForm, title: text })}
placeholderTextColor={
@@ -187,7 +187,7 @@ const AddComment = ({ addComment, productId, theme, ...props }) => {
: Colors.theme1.white + "55",
},
]}
- value={comment.text}
+ value={comment?.text}
multiline={true}
textAlignVertical="top"
placeholder="متن نظر ..."
@@ -198,7 +198,7 @@ const AddComment = ({ addComment, productId, theme, ...props }) => {
: Colors.theme1.white + "aa"
}
/>
- {commentForm.title && commentForm.text ? (
+ {commentForm?.title && commentForm?.text ? (
{
return (
refRBSheet.current.open()}
style={[
tw(
`flex flex-row-reverse justify-between items-center mt-3 rounded-md px-2 ${
@@ -241,7 +240,7 @@ const ProductReviews = ({ list, mobile, theme }) => {
},
]}
>
- {question.title}
+ {question?.title}
{
textAlign: ios ? "right" : "auto",
}}
>
- {question.text}
+ {question?.text}
- {question.images.map((image, index) => (
+ {question?.images?.map((image, index) => (
onPress()}
diff --git a/src/screens/Product/components/Sample.js b/src/screens/Product/components/Sample.js
index 25dbd1c..e375afa 100644
--- a/src/screens/Product/components/Sample.js
+++ b/src/screens/Product/components/Sample.js
@@ -27,7 +27,7 @@ const Sample = ({route}) => {
/>
diff --git a/src/screens/Products/components/Main.js b/src/screens/Products/components/Main.js
index 6c35bae..9c1a1ac 100644
--- a/src/screens/Products/components/Main.js
+++ b/src/screens/Products/components/Main.js
@@ -46,14 +46,14 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
bySubjectFilter = byGradeFilter?.filter(
(book) =>
book?.product[type]?.name?.indexOf(subject) !== -1 ||
- book?.name.indexOf(subject) !== -1
+ book?.name?.indexOf(subject) !== -1
);
} else {
bySubjectFilter = byGradeFilter;
}
if (available) {
byAvailableFilter = bySubjectFilter?.filter(
- (book) => book.product[type].price
+ (book) => book?.product[type]?.price
);
} else {
byAvailableFilter = bySubjectFilter;
@@ -62,13 +62,13 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
bySearchFilter = byAvailableFilter?.filter(
(book) =>
book?.product[type]?.name?.indexOf(search) !== -1 ||
- book?.name.indexOf(search) !== -1
+ book?.name?.indexOf(search) !== -1
);
} else {
bySearchFilter = byAvailableFilter;
}
- return filterOptions.productType === "دوره ویدئویی"
+ return filterOptions?.productType === "دوره ویدئویی"
? bySearchFilter?.map((product, index) => (
// {
},
]}
>
- {separate(product?.product[0].price)}
+ {separate(product?.product[0]?.price)}
{
back: true,
}}
/>
- {myCourses.length ? (
+ {myCourses?.length ? (
userAddressId === address?.id
? {}
- : update({ userAddressId: address.id, userId })
+ : update({ userAddressId: address?.id, userId })
}
>
@@ -130,7 +130,7 @@ const ProfileAddress = ({
showCancelButton: true,
confirmText: "بله",
cancelText: "لغو",
- onConfirm: () => deleteItem({ id: address.id }),
+ onConfirm: () => deleteItem({ id: address?.id }),
})
}
>
@@ -167,7 +167,7 @@ const ProfileAddress = ({
},
]}
>
- {"آدرس:" + " " + address.address}
+ {"آدرس:" + " " + address?.address}
- {"نام:" + " " + address.firstName + " " + address.lastName}
+ {"نام:" + " " + address?.firstName + " " + address?.lastName}
- {"کد پستی:" + " " + address.postalCode}
+ {"کد پستی:" + " " + address?.postalCode}
- {"شماره تماس:" + " " + address.cellphone}
+ {"شماره تماس:" + " " + address?.cellphone}
{!active ? (
@@ -248,7 +248,7 @@ const ProfileAddress = ({
showCancelButton: true,
confirmText: "بله",
cancelText: "لغو",
- onConfirm: () => deleteItem({ id: address.id }),
+ onConfirm: () => deleteItem({ id: address?.id }),
})
}
>
@@ -310,7 +310,7 @@ const ProfileAddress = ({
back: true,
}}
/>
- {addresses.length > 0 ? (
+ {addresses?.length ? (
- {addresses.map((address, index) => (
+ {addresses?.map((address, index) => (
- {bookmarkList.length ? (
+ {bookmarkList?.length ? (
{
) : (
deleteAction(deleteItem({ id: bookmark.id }))}
+ onPress={() => deleteAction(deleteItem({ id: bookmark?.id }))}
>