From 69784965077b382d349459ac31a6b61cb36a47af Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Wed, 11 May 2022 14:24:49 +0430 Subject: [PATCH] fixed .? --- src/screens/DeliveryForm/Address/index.js | 10 +-- .../DeliveryForm/TransportDate/index.js | 84 +++++++++++-------- .../DeliveryForm/TransportMethod/index.js | 4 +- src/screens/DeliveryForm/index.js | 6 +- src/screens/Faq/components/Instance.js | 8 +- src/screens/Faq/index.js | 2 +- src/screens/Home/components/Blogs.js | 8 +- src/screens/Home/components/MyBooks.js | 4 +- src/screens/Home/components/Scroll.js | 4 +- src/screens/Home/components/Videos.js | 14 ++-- src/screens/Home/index.js | 8 +- src/screens/OrderDetails/components/Book.js | 10 +-- src/screens/OrderDetails/index.js | 24 +++--- .../OrdersFollowUp/components/Order.js | 14 ++-- src/screens/OrdersFollowUp/index.js | 30 +------ 15 files changed, 107 insertions(+), 123 deletions(-) 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 }) => (