ordering-ui-react-native 0.15.62 → 0.15.64-release

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/package.json +7 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/AddressForm/index.tsx +18 -2
  4. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  5. package/src/components/BusinessController/index.tsx +16 -8
  6. package/src/components/BusinessInformation/index.tsx +14 -0
  7. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  8. package/src/components/BusinessesListing/index.tsx +1 -1
  9. package/src/components/Checkout/index.tsx +23 -2
  10. package/src/components/DriverTips/index.tsx +11 -6
  11. package/src/components/LanguageSelector/index.tsx +6 -2
  12. package/src/components/LoginForm/index.tsx +120 -30
  13. package/src/components/LoginForm/styles.tsx +6 -0
  14. package/src/components/OrderDetails/index.tsx +7 -21
  15. package/src/components/PaymentOptions/index.tsx +67 -50
  16. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  17. package/src/components/ReviewDriver/index.tsx +1 -1
  18. package/src/components/ReviewOrder/index.tsx +2 -1
  19. package/src/components/ReviewProducts/index.tsx +11 -0
  20. package/src/components/SignupForm/index.tsx +145 -61
  21. package/src/components/SingleProductCard/index.tsx +16 -4
  22. package/src/components/SingleProductReview/index.tsx +1 -1
  23. package/src/components/StripeMethodForm/index.tsx +22 -24
  24. package/src/components/UpsellingProducts/index.tsx +1 -1
  25. package/src/components/UserProfileForm/index.tsx +63 -6
  26. package/src/components/UserProfileForm/styles.tsx +8 -0
  27. package/src/components/VerifyPhone/styles.tsx +1 -2
  28. package/src/components/shared/OModal.tsx +1 -1
  29. package/src/hooks/useCountdownTimer.tsx +26 -0
  30. package/src/navigators/CheckoutNavigator.tsx +6 -0
  31. package/src/navigators/HomeNavigator.tsx +12 -0
  32. package/src/pages/BusinessesListing.tsx +7 -6
  33. package/src/pages/MultiCheckout.tsx +31 -0
  34. package/src/pages/MultiOrdersDetails.tsx +27 -0
  35. package/src/pages/OrderDetails.tsx +1 -1
  36. package/src/pages/ReviewDriver.tsx +2 -2
  37. package/src/pages/ReviewOrder.tsx +2 -2
  38. package/src/pages/Sessions.tsx +22 -0
  39. package/src/theme.json +0 -1
  40. package/src/types/index.tsx +18 -11
  41. package/src/utils/index.tsx +68 -1
  42. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  43. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  44. package/themes/business/src/components/Chat/index.tsx +42 -90
  45. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  46. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  47. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  48. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  49. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  50. package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
  51. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  52. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
  53. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  54. package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
  55. package/themes/business/src/components/OrdersOption/index.tsx +8 -4
  56. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  57. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  58. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  59. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  60. package/themes/business/src/components/shared/OModal.tsx +1 -1
  61. package/themes/business/src/types/index.tsx +8 -2
  62. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  63. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  64. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  65. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  66. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  67. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  68. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  69. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  70. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  71. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  72. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  73. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  74. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  75. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  76. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  77. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  78. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  79. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  80. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  81. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  82. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  83. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  84. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  85. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  86. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  87. package/themes/kiosk/src/types/index.d.ts +1 -0
  88. package/themes/original/index.tsx +30 -8
  89. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  90. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  91. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  92. package/themes/original/src/components/AddressList/index.tsx +30 -18
  93. package/themes/original/src/components/AppleLogin/index.tsx +7 -12
  94. package/themes/original/src/components/BusinessBasicInformation/index.tsx +305 -159
  95. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  96. package/themes/original/src/components/BusinessController/index.tsx +168 -96
  97. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  98. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  99. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  100. package/themes/original/src/components/BusinessListingSearch/index.tsx +231 -63
  101. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  102. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  103. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  104. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  105. package/themes/original/src/components/BusinessProductsList/index.tsx +51 -52
  106. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  107. package/themes/original/src/components/BusinessProductsListing/index.tsx +317 -155
  108. package/themes/original/src/components/BusinessProductsListing/styles.tsx +32 -0
  109. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  110. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
  111. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  112. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +560 -0
  113. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  114. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +679 -0
  115. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  116. package/themes/original/src/components/BusinessesListing/index.tsx +99 -458
  117. package/themes/original/src/components/Cart/index.tsx +62 -43
  118. package/themes/original/src/components/Checkout/index.tsx +90 -39
  119. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  120. package/themes/original/src/components/Favorite/index.tsx +92 -0
  121. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  122. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  123. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  124. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  125. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  126. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  127. package/themes/original/src/components/Help/index.tsx +21 -4
  128. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  129. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  130. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  131. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  132. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  133. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  134. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  135. package/themes/original/src/components/Messages/index.tsx +1 -1
  136. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  137. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  138. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  139. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  140. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  141. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  142. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  143. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  144. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  145. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  146. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  147. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  148. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  149. package/themes/original/src/components/NavBar/index.tsx +4 -4
  150. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  151. package/themes/original/src/components/OrderDetails/index.tsx +151 -65
  152. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  153. package/themes/original/src/components/OrderSummary/index.tsx +6 -6
  154. package/themes/original/src/components/OrderTypeSelector/index.tsx +79 -35
  155. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  156. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  157. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  158. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  159. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  160. package/themes/original/src/components/OrdersOption/index.tsx +137 -38
  161. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  162. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  163. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  164. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  165. package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
  166. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  167. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  168. package/themes/original/src/components/ProductForm/index.tsx +718 -679
  169. package/themes/original/src/components/ProductForm/styles.tsx +6 -2
  170. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  171. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  172. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  173. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  174. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  175. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  176. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  177. package/themes/original/src/components/Promotions/index.tsx +151 -133
  178. package/themes/original/src/components/Promotions/styles.tsx +3 -23
  179. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  180. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  181. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  182. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  183. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  184. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  185. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  186. package/themes/original/src/components/Sessions/index.tsx +160 -0
  187. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  188. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  189. package/themes/original/src/components/SingleOrderCard/index.tsx +275 -0
  190. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  191. package/themes/original/src/components/SingleProductCard/index.tsx +161 -88
  192. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  193. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  194. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  195. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  196. package/themes/original/src/components/UserDetails/index.tsx +15 -81
  197. package/themes/original/src/components/UserFormDetails/index.tsx +98 -66
  198. package/themes/original/src/components/UserProfile/index.tsx +11 -2
  199. package/themes/original/src/components/UserProfileForm/index.tsx +33 -22
  200. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  201. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  202. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  203. package/themes/original/src/components/Wallets/index.tsx +76 -9
  204. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  205. package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
  206. package/themes/original/src/components/shared/OButton.tsx +2 -0
  207. package/themes/original/src/components/shared/OInput.tsx +3 -2
  208. package/themes/original/src/components/shared/OModal.tsx +4 -2
  209. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  210. package/themes/original/src/types/index.tsx +187 -35
  211. package/themes/original/src/utils/index.tsx +96 -2
  212. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  213. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,7 +1,8 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { Pressable, View } from 'react-native';
2
+ import { Pressable, StyleSheet, View } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native'
4
4
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
+ import FastImage from 'react-native-fast-image'
5
6
  import {
6
7
  WalletList,
7
8
  useLanguage,
@@ -15,7 +16,10 @@ import {
15
16
  TransactionsWrapper,
16
17
  OTabs,
17
18
  OTab,
18
- SectionContent
19
+ SectionContent,
20
+ LoyaltyContent,
21
+ LoyaltyWrapp,
22
+ LoyaltyImg
19
23
  } from './styles'
20
24
 
21
25
  import NavBar from '../NavBar'
@@ -27,10 +31,14 @@ const WalletsUI = (props: any) => {
27
31
  const {
28
32
  navigation,
29
33
  walletList,
34
+ userLoyaltyLevel,
30
35
  transactionsList,
31
36
  setWalletSelected,
32
37
  isWalletCashEnabled,
33
- isWalletPointsEnabled
38
+ isWalletPointsEnabled,
39
+ getWallets,
40
+ refreshWallets,
41
+ setRefreshWallets
34
42
  } = props
35
43
 
36
44
  const [, t] = useLanguage()
@@ -38,12 +46,27 @@ const WalletsUI = (props: any) => {
38
46
  const [{ parsePrice }] = useUtils()
39
47
  const [{ configs }] = useConfig()
40
48
 
49
+ const styles = StyleSheet.create({
50
+ logoStyle: {
51
+ width: 120,
52
+ height: 120,
53
+ borderRadius: 8,
54
+ borderWidth: 1,
55
+ borderColor: theme.colors.border,
56
+ flexDirection: 'column',
57
+ justifyContent: 'center',
58
+ alignItems: 'center',
59
+ }
60
+ });
61
+
41
62
  const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
42
63
 
43
- const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
64
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
44
65
 
45
66
  const currentWalletSelected = (walletList.wallets?.length > 0 && walletList.wallets?.find((w: any) => w.type === tabSelected)) ?? null
46
67
 
68
+ const loyaltyLevel = Object.keys(userLoyaltyLevel.loyaltyLevel ?? {}).length > 0 && userLoyaltyLevel.loyaltyLevel
69
+
47
70
  const walletName: any = {
48
71
  cash: {
49
72
  name: t('CASH_WALLET', 'Cash Wallet'),
@@ -74,6 +97,13 @@ const WalletsUI = (props: any) => {
74
97
  }
75
98
  }, [configs])
76
99
 
100
+ useEffect(() => {
101
+ if(refreshWallets){
102
+ getWallets()
103
+ setRefreshWallets && setRefreshWallets(false)
104
+ }
105
+ }, [refreshWallets])
106
+
77
107
  return (
78
108
  <Container>
79
109
  <NavBar
@@ -86,18 +116,22 @@ const WalletsUI = (props: any) => {
86
116
  />
87
117
 
88
118
  {!walletList.loading &&
119
+ !userLoyaltyLevel.loading &&
89
120
  !walletList.error &&
90
121
  walletList.wallets?.length > 0 &&
91
122
  (
92
123
  <>
93
- <OTabs>
124
+ <OTabs
125
+ horizontal
126
+ showsHorizontalScrollIndicator={false}
127
+ >
94
128
  {walletList.wallets?.map((wallet: any) => walletName[wallet.type]?.isActive && (
95
129
  <Pressable
96
130
  key={wallet.id}
97
131
  onPress={() => handleChangeTab(wallet)}
98
132
  >
99
- <OTab>
100
- <OText size={18} color={tabSelected === wallet.type ? theme.colors.primary : theme.colors.disabled}>
133
+ <OTab isSelected={tabSelected === wallet.type}>
134
+ <OText size={18}>
101
135
  {walletName[wallet.type]?.name}
102
136
  </OText>
103
137
  </OTab>
@@ -106,6 +140,39 @@ const WalletsUI = (props: any) => {
106
140
  </OTabs>
107
141
 
108
142
  <SectionContent>
143
+ {!!loyaltyLevel && tabSelected === 'credit_point' && (
144
+ <LoyaltyContent>
145
+ <LoyaltyWrapp>
146
+ <OText size={20}>
147
+ {`${t('LOYALTY_LEVEL_TITLE', 'Your level is')}:`}
148
+ </OText>
149
+ {loyaltyLevel.image ? (
150
+ <FastImage
151
+ style={styles.logoStyle}
152
+ source={{
153
+ uri: loyaltyLevel.image,
154
+ priority: FastImage.priority.high,
155
+ cache:FastImage.cacheControl.web
156
+ }}
157
+ resizeMode={FastImage.resizeMode.contain}
158
+ />
159
+ ) : (
160
+ <LoyaltyImg
161
+ source={theme.images.dummies.loyaltyLevel}
162
+ resizeMode='contain'
163
+ />
164
+ )}
165
+ <OText
166
+ size={22}
167
+ weight='bold'
168
+ style={{ textTransform: 'uppercase' }}
169
+ color={theme.colors.primary}
170
+ >
171
+ {loyaltyLevel.name}
172
+ </OText>
173
+ </LoyaltyWrapp>
174
+ </LoyaltyContent>
175
+ )}
109
176
  <BalanceElement>
110
177
  <OText size={20} style={{fontWeight: '600'}}>
111
178
  {currentWalletSelected?.type === 'cash'
@@ -172,7 +239,7 @@ const WalletsUI = (props: any) => {
172
239
  </>
173
240
  )}
174
241
 
175
- {walletList?.loading && (
242
+ {(walletList?.loading || userLoyaltyLevel.loading) && (
176
243
  <>
177
244
  <View>
178
245
  <Placeholder Animation={Fade}>
@@ -196,7 +263,7 @@ const WalletsUI = (props: any) => {
196
263
  </>
197
264
  )}
198
265
 
199
- {!walletList?.loading && (walletList?.error || !walletList?.wallets?.length) && (
266
+ {!walletList?.loading && !userLoyaltyLevel.loading && (walletList?.error || !walletList?.wallets?.length) && (
200
267
  <NotFoundSource
201
268
  content={walletList?.error
202
269
  ? t('ERROR_NOT_FOUND_WALLETS', 'Sorry, an error has occurred')
@@ -41,3 +41,24 @@ export const OTabs = styled.View`
41
41
  export const OTab = styled.View`
42
42
  padding-horizontal: 10px;
43
43
  `;
44
+
45
+ export const LoyaltyContent = styled.View`
46
+ width: 100%;
47
+ margin-bottom: 20px;
48
+ `
49
+
50
+ export const LoyaltyWrapp = styled.View`
51
+ flex-direction: column;
52
+ justify-content: center;
53
+ align-items: center;
54
+ `
55
+
56
+ export const LoyaltyImg = styled.ImageBackground`
57
+ position: relative;
58
+ height: 150px;
59
+ width: 100%;
60
+ display: flex;
61
+ flex-direction: column;
62
+ justify-content: center;
63
+ align-items: center;
64
+ `
@@ -1,33 +1,43 @@
1
1
  import React from 'react'
2
- import { Modal, TouchableWithoutFeedback, Dimensions, StyleSheet, View, Text, Platform, StatusBar } from 'react-native'
2
+ import { Modal, TouchableWithoutFeedback, TouchableOpacity, Dimensions, StyleSheet, View, Text, Platform, StatusBar } from 'react-native'
3
3
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
4
+ import { OIcon } from '.';
4
5
  const deviceHeight = Dimensions.get('window').height
5
6
 
6
7
  interface Props {
7
8
  open: boolean;
9
+ transparent?: boolean;
8
10
  title?: string;
9
11
  children?: any;
10
12
  onClose?: any;
11
13
  isStatusBar?: boolean;
14
+ bottomContainerStyle?: any;
15
+ titleStyle?: any;
16
+ closeIcon?: any;
12
17
  }
13
18
  const OBottomPopup = (props: Props) => {
14
19
  const {
15
20
  open,
21
+ transparent,
16
22
  title,
17
23
  onClose,
18
24
  children,
19
- isStatusBar
25
+ isStatusBar,
26
+ titleStyle,
27
+ bottomContainerStyle,
28
+ closeIcon
20
29
  } = props
21
30
  const { top, bottom } = useSafeAreaInsets();
31
+
22
32
  return (
23
33
  <Modal
24
34
  animationType='slide'
25
- transparent={false}
35
+ transparent={transparent}
26
36
  visible={open}
27
37
  onRequestClose={() => onClose()}
28
38
  presentationStyle={'fullScreen'}
29
39
  >
30
- {isStatusBar && <StatusBar translucent={false} />}
40
+ {isStatusBar && <StatusBar translucent={false} />}
31
41
  <View style={styles.container}>
32
42
  <TouchableWithoutFeedback
33
43
  style={styles.touchableOutsideStyle}
@@ -35,13 +45,24 @@ const OBottomPopup = (props: Props) => {
35
45
  >
36
46
  <View style={styles.touchableOutsideStyle} />
37
47
  </TouchableWithoutFeedback>
38
- <View style={styles.bottomContainer}>
48
+ <View style={{ ...styles.bottomContainer, ...bottomContainerStyle }}>
39
49
  <View style={{ paddingTop: top, paddingBottom: bottom }}>
40
- {title != '' && (
41
- <Text style={styles.titleStyle}>
42
- {title}
43
- </Text>
44
- )}
50
+ <View style={styles.modalTitleStyle}>
51
+ {closeIcon && (
52
+ <TouchableOpacity onPress={() => onClose()} style={styles.closeIconStyle}>
53
+ <OIcon
54
+ src={closeIcon}
55
+ width={20}
56
+ height={20}
57
+ />
58
+ </TouchableOpacity>
59
+ )}
60
+ {!!title && (
61
+ <Text style={{ ...styles.titleStyle, ...titleStyle }}>
62
+ {title}
63
+ </Text>
64
+ )}
65
+ </View>
45
66
  {children}
46
67
  </View>
47
68
  </View>
@@ -54,7 +75,7 @@ const styles = StyleSheet.create({
54
75
  container: {
55
76
  flex: 1,
56
77
  backgroundColor: '#000000AA',
57
- justifyContent: 'flex-end',
78
+ justifyContent: 'flex-end'
58
79
  },
59
80
  touchableOutsideStyle: {
60
81
  flex: 1,
@@ -68,8 +89,18 @@ const styles = StyleSheet.create({
68
89
  },
69
90
  titleStyle: {
70
91
  fontSize: 20,
71
- fontWeight: 'bold',
72
- marginVertical: 15
92
+ fontWeight: 'bold'
93
+ },
94
+ closeIconStyle: {
95
+ position: 'absolute',
96
+ left: 25,
97
+ top: 25,
98
+ zIndex: 100
99
+ },
100
+ modalTitleStyle: {
101
+ position: 'relative',
102
+ paddingHorizontal: 10,
103
+ paddingVertical: 20
73
104
  }
74
105
  })
75
106
 
@@ -78,6 +78,7 @@ interface Props {
78
78
  borderColor?: string;
79
79
  loadingStyle?: ViewStyle;
80
80
  showNextIcon?: boolean;
81
+ isDisabledWithSameStyles?: boolean;
81
82
  }
82
83
 
83
84
  const OButton = (props: Props): React.ReactElement => {
@@ -110,6 +111,7 @@ const OButton = (props: Props): React.ReactElement => {
110
111
  activeOpacity={props.activeOpacity}
111
112
  onPress={props.onClick}
112
113
  style={{ width: props.isCircle ? 52 : props.style?.width, ...props.parentStyle }}
114
+ disabled={props.isDisabledWithSameStyles}
113
115
  >
114
116
  <StyledButton style={props.bgColor ? { ...props.style, backgroundColor: props.bgColor, borderColor: props.borderColor } : props.style}>
115
117
  {props.imgLeftSrc ? (
@@ -56,7 +56,7 @@ const Wrapper = styled.Pressable`
56
56
  const OInput = (props: Props): React.ReactElement => {
57
57
  return (
58
58
  <Wrapper
59
- onPress={() => {props.forwardRef?.current?.focus?.(); props.onPress && props.onPress()}}
59
+ onPress={() => { props.forwardRef?.current?.focus?.(); props.onPress && props.onPress() }}
60
60
  style={{
61
61
  backgroundColor: props.bgColor,
62
62
  borderColor: props.borderColor,
@@ -75,6 +75,7 @@ const OInput = (props: Props): React.ReactElement => {
75
75
  <MaterialIcon name={props?.vertorIcon} size={20} color={props?.vectorIconColor} style={{ marginHorizontal: 10 }} />
76
76
  )}
77
77
  <Input
78
+ autoFocus={props?.autoFocus}
78
79
  name={props.name}
79
80
  secureTextEntry={props.isSecured}
80
81
  onChangeText={(txt: any) => props.name ? props.onChange({ target: { name: props.name, value: txt } }) : props.onChange(txt)}
@@ -90,7 +91,7 @@ const OInput = (props: Props): React.ReactElement => {
90
91
  returnKeyType={props.returnKeyType}
91
92
  onSubmitEditing={props.onSubmitEditing}
92
93
  blurOnSubmit={props.blurOnSubmit}
93
- ref={(e : any) => {
94
+ ref={(e: any) => {
94
95
  props.forwardRef && (props.forwardRef.current = e)
95
96
  }}
96
97
  style={props?.inputStyle}
@@ -21,6 +21,7 @@ interface Props {
21
21
  isNotDecoration?: boolean;
22
22
  styleCloseButton?: any,
23
23
  isAvoidKeyBoardView?: boolean;
24
+ styleContainerCloseButton?: any;
24
25
  }
25
26
  const KeyboardView = styled.KeyboardAvoidingView`
26
27
  flex-grow: 1;
@@ -45,6 +46,7 @@ const OModal = (props: Props): React.ReactElement => {
45
46
  isNotDecoration,
46
47
  style,
47
48
  styleCloseButton,
49
+ styleContainerCloseButton,
48
50
  isAvoidKeyBoardView
49
51
  } = props
50
52
 
@@ -55,7 +57,7 @@ const OModal = (props: Props): React.ReactElement => {
55
57
  {!entireModal ? (
56
58
  <View style={styles.centeredView}>
57
59
  <View style={titleSectionStyle ? titleSectionStyle : styles.titleSection}>
58
- <TouchableOpacity style={styles.wrapperIcon} onPress={onClose}>
60
+ <TouchableOpacity style={{...styles.wrapperIcon, ...styleContainerCloseButton}} onPress={onClose}>
59
61
  <OIcon
60
62
  src={theme.images.general.close}
61
63
  width={16}
@@ -91,7 +93,7 @@ const OModal = (props: Props): React.ReactElement => {
91
93
  animationType="slide"
92
94
  transparent={isTransparent}
93
95
  visible={open}
94
- onRequestClose={() => onClose()}
96
+ onRequestClose={() => onClose && onClose()}
95
97
  style={{ height: '100%', flex: 1, position: 'absolute', ...style, zIndex: 9999 }}
96
98
  >
97
99
  {isAvoidKeyBoardView ? (
@@ -19,7 +19,11 @@ export const Container = styled.View`
19
19
 
20
20
  export const FloatingBottomContainer = (props: any) => {
21
21
  return (
22
- <Container style={{ width: windowWidth }}>
22
+ <Container style={{
23
+ width: windowWidth,
24
+ borderTopWidth: props?.borderTopWidth ?? 1,
25
+ borderRadius: props?.borderRadius ?? 0
26
+ }}>
23
27
  {props.children}
24
28
  </Container>
25
29
  )