diff --git a/src/screens/DeliveryForm/Address/index.js b/src/screens/DeliveryForm/Address/index.js
index d19ef93..b5ed183 100644
--- a/src/screens/DeliveryForm/Address/index.js
+++ b/src/screens/DeliveryForm/Address/index.js
@@ -63,11 +63,11 @@ const Address = ({
),
]}
onPress={() => {
- setSelectedItem(address.id);
- active ? {} : update({ userAddressId: address.id, userId });
+ setSelectedItem(address?.id);
+ active ? {} : update({ userAddressId: address?.id, userId });
}}
>
- {selectedItem === address.id && loading ? (
+ {selectedItem === address?.id && loading ? (
) : active ? (
- {address.address}
+ {address?.address}
@@ -110,7 +110,7 @@ const Address = ({
return (
- {addresses.map((address, index) => (
+ {addresses?.map((address, index) => (
{
return (
setActiveDate(time)}
@@ -38,40 +42,48 @@ const TransportDate = ({ transportDate, mobile, theme }) => {
fontFamily: "regular",
fontSize: mobile ? fontSize.tiny : fontSize.xl,
color: active
- ? light ? Colors.theme1.gray20 : Colors.theme1.greenCF
- : light ? Colors.theme1.gray20 : Colors.theme1.white,
+ ? light
+ ? Colors.theme1.gray20
+ : Colors.theme1.greenCF
+ : light
+ ? Colors.theme1.gray20
+ : Colors.theme1.white,
}}
>
- {time.time}
+ {time?.time}
-
+
-
-
- تکمیل ظرفیت
-
-
+
+
+ تکمیل ظرفیت
+
+
);
}, []);
-
+
return (
{
fontSize: mobile ? fontSize.base : fontSize.xl2,
fontFamily: "bold",
color: light ? Colors.theme1.green79 : Colors.theme1.white,
- textAlign : ios ? "right" : "auto",
+ textAlign: ios ? "right" : "auto",
}}
>
زمان ارسال را انتخاب کنید.
@@ -95,7 +107,7 @@ const TransportDate = ({ transportDate, mobile, theme }) => {
const mapStateToProps = (state) => ({
mobile: state.publicApi.mobile,
- theme: state.publicApi.theme
+ theme: state.publicApi.theme,
});
const mapDispatchToProps = {};
diff --git a/src/screens/DeliveryForm/TransportMethod/index.js b/src/screens/DeliveryForm/TransportMethod/index.js
index 356c997..eacf7bf 100644
--- a/src/screens/DeliveryForm/TransportMethod/index.js
+++ b/src/screens/DeliveryForm/TransportMethod/index.js
@@ -99,7 +99,7 @@ const TransportMethod = ({
: Colors.theme1.white,
}}
>
- {method.name}
+ {method?.name}
)}
@@ -130,7 +130,7 @@ const TransportMethod = ({
: Colors.theme1.white,
}}
>
- {separate(method.price) + " " + "تومان"}
+ {separate(method?.price) + " " + "تومان"}
diff --git a/src/screens/DeliveryForm/index.js b/src/screens/DeliveryForm/index.js
index cf7dab2..66e869d 100644
--- a/src/screens/DeliveryForm/index.js
+++ b/src/screens/DeliveryForm/index.js
@@ -80,9 +80,9 @@ const DeliveryForm = ({
- {factorInfo.transportId === 2 ? (
+ {factorInfo?.transportId === 2 ? (
-
+
) : null}
@@ -95,7 +95,7 @@ const DeliveryForm = ({
border={{ color: "#196EC0", width: 0 }}
width={"100%"}
onPress={() =>
- factorInfo.transportId && factorInfo.userAddressId
+ factorInfo?.transportId && factorInfo?.userAddressId
? payFactor({ userId })
: asyncAwesomeAlert("خطا", "آدرس یا نحوه ارسال را وارد کنید", {
showCancelButton: false,
diff --git a/src/screens/Faq/components/Instance.js b/src/screens/Faq/components/Instance.js
index df24726..8be31b9 100644
--- a/src/screens/Faq/components/Instance.js
+++ b/src/screens/Faq/components/Instance.js
@@ -40,9 +40,9 @@ function Instance({ question, selectFaq, mobile, theme }) {
},
]}
>
- {question.title}
+ {question?.title}
- {question.active ? (
+ {question?.active ? (
)}
- {question.active ? (
+ {question?.active ? (
- {question.description}
+ {question?.description}
) : null}
diff --git a/src/screens/Faq/index.js b/src/screens/Faq/index.js
index 03efb51..bc3c029 100644
--- a/src/screens/Faq/index.js
+++ b/src/screens/Faq/index.js
@@ -80,7 +80,7 @@ function Faq({
placeholder={"بخشی از پرسش خود را اینجا بنویسید"}
/>
- {search.length ? (
+ {search?.length ? (
searchResult?.length ? (
- {blogs.length ? (
+ {blogs?.length ? (
<>
@@ -40,11 +40,11 @@ function Blogs({ blogs, mobile, theme }) {
horizontal={true}
inverted={true}
style={[tw("flex flex-row mt-3")]}
- data={blogs.slice(0, 7)}
+ data={blogs?.slice(0, 7)}
renderItem={({ item }) => (
)}
- keyExtractor={(item) => item.id}
+ keyExtractor={(item) => item?.id}
initialNumToRender={5}
/>
>
@@ -98,7 +98,7 @@ const Blog = ({ blog, mobile, theme }) => {
},
]}
>
- {blog.title}
+ {blog?.title}
diff --git a/src/screens/Home/components/MyBooks.js b/src/screens/Home/components/MyBooks.js
index b5250b9..62b3fa6 100644
--- a/src/screens/Home/components/MyBooks.js
+++ b/src/screens/Home/components/MyBooks.js
@@ -20,7 +20,7 @@ import fontSize from "../../../constants/fontSize";
const ios = Platform.OS === "ios";
function MyBooks({ books, grades, theme }) {
- return books?.filter((book) => book.condition >= 2).length ? (
+ return books?.filter((book) => book?.condition >= 2).length ? (
book.condition >= 2)}
+ data={books?.filter((book) => book?.condition >= 2)}
renderItem={({ item }) => (
)}
diff --git a/src/screens/Home/components/Scroll.js b/src/screens/Home/components/Scroll.js
index b5f7639..9555df2 100644
--- a/src/screens/Home/components/Scroll.js
+++ b/src/screens/Home/components/Scroll.js
@@ -28,7 +28,7 @@ function Scroll({ books, mobile }) {
>
@@ -43,7 +43,7 @@ function Scroll({ books, mobile }) {
{ height: mobile ? 242 : 350, direction: "rtl" },
]}
>
- {books.slice(0, 14).map((book, index) => (
+ {books.slice(0, 14)?.map((book, index) => (
))}
diff --git a/src/screens/Home/components/Videos.js b/src/screens/Home/components/Videos.js
index b887c79..886dd0f 100644
--- a/src/screens/Home/components/Videos.js
+++ b/src/screens/Home/components/Videos.js
@@ -17,7 +17,7 @@ function Videos({ videos, grades, mobile, theme }) {
return (
- {videos.length ? (
+ {videos?.length ? (
<>
@@ -27,7 +27,7 @@ function Videos({ videos, grades, mobile, theme }) {
style={[tw("py-3")]}
horizontal={true}
inverted={true}
- data={videos.slice(0, 7)}
+ data={videos?.slice(0, 7)}
renderItem={({ item }) => (
)}
- keyExtractor={(item) => item.id}
+ keyExtractor={(item) => item?.id}
/>
>
) : null}
@@ -53,10 +53,10 @@ const Video = ({ video, mobile, grades, theme }) => {
tw(`flex relative ${mobile ? "mr-4" : "ml-5"}`),
{ width: mobile ? 200 : 200, height: mobile ? 210 : 210 },
]}
- onPress={() => navigation.navigate("Video", { id: video.id })}
+ onPress={() => navigation.navigate("Video", { id: video?.id })}
>
{
},
]}
>
- {"دوره ویدئویی" + " " + video.name}
+ {"دوره ویدئویی" + " " + video?.name}
{
},
]}
>
- {"پایه" + " " + grades[video.gradeId]}
+ {"پایه" + " " + grades[video?.gradeId]}
diff --git a/src/screens/Home/index.js b/src/screens/Home/index.js
index f4b1fd4..053840e 100644
--- a/src/screens/Home/index.js
+++ b/src/screens/Home/index.js
@@ -47,11 +47,11 @@ const Home = ({
};
React.useEffect(() => {
- if (blogs.length === 0) {
+ if (blogs?.length === 0) {
getBlogs();
- } else if (books.length === 0) {
+ } else if (books?.length === 0) {
getBooks({ vod: true });
- } else if (userProducts.length === 0) {
+ } else if (userProducts?.length === 0) {
getUserProducts();
}
}, [books, userProducts, blogs]);
@@ -77,7 +77,7 @@ const Home = ({
>
{!mobile ? : null}
- {books.length ? (
+ {books?.length ? (
diff --git a/src/screens/OrderDetails/components/Book.js b/src/screens/OrderDetails/components/Book.js
index 05b77e9..7b299d7 100644
--- a/src/screens/OrderDetails/components/Book.js
+++ b/src/screens/OrderDetails/components/Book.js
@@ -23,7 +23,7 @@ function Book({ book, mobile, grades, theme }) {
- {book.product.book.name || " "}
+ {book?.product?.book?.name || " "}
- {"پایه" + " " + grades[book.product.book.gradeId]}
+ {"پایه" + " " + grades[book?.product?.book?.gradeId]}
{/*
- {book.product.count}
+ {book?.product?.count}
- {book.product.price}
+ {book?.product?.price}
diff --git a/src/screens/OrderDetails/index.js b/src/screens/OrderDetails/index.js
index a6ab5e6..8e47c98 100644
--- a/src/screens/OrderDetails/index.js
+++ b/src/screens/OrderDetails/index.js
@@ -43,7 +43,7 @@ const status = {
};
function OrderDetails({ mobile, route, theme }) {
- const { order } = route.params;
+ const { order } = route?.params;
const [position, setPosition] = useState("100%");
React.useEffect(() => {
@@ -112,12 +112,12 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
- {status[order.condition]}
+ {status[order?.condition]}
@@ -206,7 +206,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
- {order.recieverName || " "}
+ {order?.recieverName || " "}
@@ -240,7 +240,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
- {order.recieverPhone || " "}
+ {order?.recieverPhone || " "}
@@ -272,7 +272,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
- {"کد تحویل" + " " + order.recieverPostalCode}
+ {"کد تحویل" + " " + order?.recieverPostalCode}
- {order.userProducts.map((item, index) => (
+ {order?.userProducts.map((item, index) => (
))}
@@ -331,7 +331,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
- {order.sumPrice + " " + "تومان"}
+ {order?.sumPrice + " " + "تومان"}
@@ -375,7 +375,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
- {order.transportPrice + " " + "تومان"}
+ {order?.transportPrice + " " + "تومان"}
@@ -408,7 +408,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
- {order.payPrice + " " + "تومان"}
+ {order?.payPrice + " " + "تومان"}
@@ -452,7 +452,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
- {order.transactionId}
+ {order?.transactionId}
@@ -487,7 +487,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
- {moment(order.payedAt).format("jYYYY/jMM/jDD")}
+ {moment(order?.payedAt)?.format("jYYYY/jMM/jDD")}
diff --git a/src/screens/OrdersFollowUp/components/Order.js b/src/screens/OrdersFollowUp/components/Order.js
index 2c30ca0..69fda06 100644
--- a/src/screens/OrdersFollowUp/components/Order.js
+++ b/src/screens/OrdersFollowUp/components/Order.js
@@ -67,7 +67,7 @@ function Order({ order, mobile, theme }) {
},
]}
>
- {"شماره سفارش:" + " " + order.transactionId}
+ {"شماره سفارش:" + " " + order?.transactionId}
- {status[order.condition]}
+ {status[order?.condition]}
@@ -96,7 +96,7 @@ function Order({ order, mobile, theme }) {
- {order.userProducts.map((product, index) => (
+ {order?.userProducts?.map((product, index) => (
- {"کد تحویل:" + " " + order.followCode}
+ {"کد تحویل:" + " " + order?.followCode}
@@ -144,7 +144,7 @@ function Order({ order, mobile, theme }) {
},
]}
>
- {"جمع فاکتور:" + " " + order.payPrice}
+ {"جمع فاکتور:" + " " + order?.payPrice}
navigation.navigate("Order", { order: order })}
@@ -199,7 +199,7 @@ function Order({ order, mobile, theme }) {
>
{"تاریخ سفارش:" +
" " +
- moment(order.payedAt).format("jYYYY/jMM/jDD")}
+ moment(order?.payedAt)?.format("jYYYY/jMM/jDD")}
diff --git a/src/screens/OrdersFollowUp/index.js b/src/screens/OrdersFollowUp/index.js
index 725cd62..66fb16b 100644
--- a/src/screens/OrdersFollowUp/index.js
+++ b/src/screens/OrdersFollowUp/index.js
@@ -67,7 +67,7 @@ function OrdersFollowUp({ orders, getList, theme }) {
contentContainerStyle={styles.contentContainerStyle}
style={styles.container}
>
- {orders.map((order, index) => (
+ {orders?.map((order, index) => (
))}
@@ -105,31 +105,3 @@ const mapDispatchToProps = {
export default connect(mapStateToProps, mapDispatchToProps)(OrdersFollowUp);
-OrdersFollowUp.defaultProps = {
- orders: [
- {
- number: "535353523653",
- receiveCode: "300031",
- status: 2,
- items: [b1Image, b1Image, b1Image, b1Image],
- date: "1400/1/12",
- cost: "1.240.000",
- },
- {
- number: "535353523653",
- receiveCode: "300031",
- status: 3,
- items: [b1Image, b1Image, b1Image],
- date: "1400/1/12",
- cost: "1.240.000",
- },
- {
- number: "535353523653",
- receiveCode: "300031",
- status: 4,
- items: [b1Image, b1Image, b1Image],
- date: "1400/1/12",
- cost: "1.240.000",
- },
- ],
-};