ordering-ui-react-native 0.16.84 → 0.16.86
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.
- package/package.json +1 -1
- package/src/components/BusinessProductsList/index.tsx +7 -7
- package/src/components/LanguageSelector/index.tsx +21 -16
- package/src/components/Messages/index.tsx +2 -2
- package/themes/original/src/components/BusinessListingSearch/index.tsx +8 -10
- package/themes/original/src/components/OrderProgress/index.tsx +8 -2
- package/themes/original/src/components/OrdersOption/index.tsx +3 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
package/package.json
CHANGED
|
@@ -34,9 +34,9 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
34
34
|
return (
|
|
35
35
|
<ProductsContainer>
|
|
36
36
|
{category.id && (
|
|
37
|
-
categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => (
|
|
37
|
+
categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any, index: number) => (
|
|
38
38
|
<SingleProductCard
|
|
39
|
-
key={product.id}
|
|
39
|
+
key={`category${category.id}-${product.id}-${index}`}
|
|
40
40
|
isSoldOut={(product.inventoried && !product.quantity)}
|
|
41
41
|
product={product}
|
|
42
42
|
businessId={businessId}
|
|
@@ -51,9 +51,9 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
51
51
|
<>
|
|
52
52
|
<OText size={18} weight='bold' mBottom={10}>{t('FEATURED', 'Featured')}</OText>
|
|
53
53
|
<>
|
|
54
|
-
{categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => product.featured && (
|
|
54
|
+
{categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any, index: number) => product.featured && (
|
|
55
55
|
<SingleProductCard
|
|
56
|
-
key={product.id}
|
|
56
|
+
key={`featured${product.id}-${index}`}
|
|
57
57
|
isSoldOut={(product.inventoried && !product.quantity)}
|
|
58
58
|
product={product}
|
|
59
59
|
businessId={businessId}
|
|
@@ -70,16 +70,16 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
70
70
|
!category.id && categories && categories.filter(category => category.id !== null).map((category, i, _categories) => {
|
|
71
71
|
const products = categoryState.products?.filter((product: any) => category?.children?.some((cat: any) => cat?.category_id === product?.category_id)) || []
|
|
72
72
|
return (
|
|
73
|
-
<View key={category.id} style={{ alignItems: 'flex-start', flex: 1 }}>
|
|
73
|
+
<View key={`category${category.id}`} style={{ alignItems: 'flex-start', flex: 1 }}>
|
|
74
74
|
{
|
|
75
75
|
products.length > 0 && (
|
|
76
76
|
<>
|
|
77
77
|
<OText size={18} weight='bold' mBottom={10}>{category.name}</OText>
|
|
78
78
|
<>
|
|
79
79
|
{
|
|
80
|
-
products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => (
|
|
80
|
+
products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any, index: number) => (
|
|
81
81
|
<SingleProductCard
|
|
82
|
-
key={product.id}
|
|
82
|
+
key={`all${product.id}-${index}`}
|
|
83
83
|
isSoldOut={product.inventoried && !product.quantity}
|
|
84
84
|
businessId={businessId}
|
|
85
85
|
product={product}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { Platform, StyleSheet, NativeModules } from 'react-native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import
|
|
4
|
+
import RNRestart from 'react-native-restart'
|
|
5
|
+
import { LanguageSelector as LanguageSelectorController, useOrder, useLanguage } from 'ordering-components/native'
|
|
5
6
|
|
|
6
7
|
import RNPickerSelect from 'react-native-picker-select'
|
|
7
8
|
import { Container, DummyContainer } from './styles'
|
|
8
9
|
import { LanguageSelectorParams } from '../../types'
|
|
9
|
-
import { OIcon } from '../shared'
|
|
10
|
-
import RNRestart from 'react-native-restart'
|
|
11
10
|
|
|
12
11
|
const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
13
12
|
|
|
@@ -19,6 +18,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
19
18
|
} = props
|
|
20
19
|
|
|
21
20
|
const [orderState] = useOrder()
|
|
21
|
+
const [langugageState] = useLanguage()
|
|
22
22
|
const theme = useTheme();
|
|
23
23
|
|
|
24
24
|
const [language, setLanguage] = useState(currentLanguage)
|
|
@@ -70,16 +70,18 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
70
70
|
)
|
|
71
71
|
|
|
72
72
|
const changeDirection = async (language: any) => {
|
|
73
|
-
if (language
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
if (language === langugageState?.language?.code) return
|
|
74
|
+
const isArabicLang = language === 'ar'
|
|
75
|
+
const isRTLOn = NativeModules.I18nManager.isRTL
|
|
76
|
+
|
|
77
|
+
if (isArabicLang && !isRTLOn) {
|
|
78
|
+
NativeModules.I18nManager.forceRTL(!isRTLOn)
|
|
79
|
+
RNRestart.Restart();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!isArabicLang && isRTLOn) {
|
|
83
|
+
NativeModules.I18nManager.forceRTL(!isRTLOn)
|
|
84
|
+
RNRestart.Restart();
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
|
|
@@ -87,11 +89,11 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
87
89
|
changeDirection(Platform.OS === 'ios' ? language : langCode)
|
|
88
90
|
handleChangeLanguage(Platform.OS === 'ios' ? language : langCode)
|
|
89
91
|
}
|
|
90
|
-
|
|
92
|
+
|
|
91
93
|
useEffect(() => {
|
|
92
94
|
changeDirection(currentLanguage)
|
|
93
95
|
}, [])
|
|
94
|
-
|
|
96
|
+
|
|
95
97
|
return (
|
|
96
98
|
<Container>
|
|
97
99
|
{languagesState?.languages ? (
|
|
@@ -113,8 +115,11 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
export const LanguageSelector = (props: LanguageSelectorParams) => {
|
|
118
|
+
const [langugageState] = useLanguage()
|
|
119
|
+
|
|
116
120
|
const LanguageProps = {
|
|
117
121
|
...props,
|
|
122
|
+
currentLanguage: langugageState?.language?.code ?? NativeModules.I18nManager.localeIdentifier?.split('_')?.[0] ?? 'en',
|
|
118
123
|
UIComponent: LanguageSelectorUI
|
|
119
124
|
}
|
|
120
125
|
|
|
@@ -223,16 +223,14 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
223
223
|
return (
|
|
224
224
|
<BContainer>
|
|
225
225
|
<SearchWrapper>
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
/>
|
|
235
|
-
)}
|
|
226
|
+
<SearchBar
|
|
227
|
+
lazyLoad
|
|
228
|
+
inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
|
|
229
|
+
placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
|
|
230
|
+
onSearch={(val: string) => handleChangeTermValue(val)}
|
|
231
|
+
value={termValue}
|
|
232
|
+
iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
|
|
233
|
+
/>
|
|
236
234
|
</SearchWrapper>
|
|
237
235
|
{
|
|
238
236
|
noResults && (
|
|
@@ -33,6 +33,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
33
33
|
const [{ optimizeImage, parseDate, parseTime }] = useUtils()
|
|
34
34
|
const [lastOrder, setLastOrder] = useState<any>(null)
|
|
35
35
|
const imageFails = theme.images.general.emptyActiveOrders
|
|
36
|
+
const [initialLoaded, setInitialLoaded] = useState(false)
|
|
36
37
|
|
|
37
38
|
const styles = StyleSheet.create({
|
|
38
39
|
main: {
|
|
@@ -135,16 +136,21 @@ const OrderProgressUI = (props: any) => {
|
|
|
135
136
|
}
|
|
136
137
|
}, [isFocused])
|
|
137
138
|
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (orderList.loading || initialLoaded) return
|
|
141
|
+
setInitialLoaded(true)
|
|
142
|
+
}, [orderList.loading, initialLoaded])
|
|
143
|
+
|
|
138
144
|
return (
|
|
139
145
|
<>
|
|
140
|
-
{orderList?.loading && (
|
|
146
|
+
{(orderList?.loading && !initialLoaded) && (
|
|
141
147
|
<Placeholder Animation={Fade} height={Platform.OS === 'ios' ? 147.5 : 158}>
|
|
142
148
|
<PlaceholderLine height={60} style={{ borderRadius: 8, marginBottom: 10 }} />
|
|
143
149
|
<PlaceholderLine height={20} style={{ marginBottom: 10 }} />
|
|
144
150
|
<PlaceholderLine height={40} style={{ borderRadius: 8, marginBottom: 10 }} />
|
|
145
151
|
</Placeholder>
|
|
146
152
|
)}
|
|
147
|
-
{!orderList?.loading && orderList?.orders?.length > 0 && lastOrder && (
|
|
153
|
+
{(!orderList?.loading || initialLoaded) && orderList?.orders?.length > 0 && lastOrder && (
|
|
148
154
|
<View style={styles.main}>
|
|
149
155
|
<OrderInfoWrapper style={{ flex: 1 }}>
|
|
150
156
|
<View style={styles.logoWrapper}>
|
|
@@ -143,7 +143,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
143
143
|
|
|
144
144
|
useFocusEffect(
|
|
145
145
|
React.useCallback(() => {
|
|
146
|
-
|
|
146
|
+
if (!businessesSearchList) {
|
|
147
|
+
loadOrders(false, false, false, true)
|
|
148
|
+
}
|
|
147
149
|
}, [navigation])
|
|
148
150
|
)
|
|
149
151
|
|
|
@@ -47,7 +47,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
47
47
|
borderWidth: 1,
|
|
48
48
|
borderRadius: 7.6,
|
|
49
49
|
borderColor: theme.colors.border,
|
|
50
|
-
marginBottom:
|
|
50
|
+
marginBottom: 25,
|
|
51
51
|
minHeight: hideAddButton ? 100 : 165
|
|
52
52
|
},
|
|
53
53
|
titleWrapper: {
|
|
@@ -137,7 +137,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
return (
|
|
140
|
-
<InView style={{ minHeight: hideAddButton ? 125 :
|
|
140
|
+
<InView style={{ minHeight: hideAddButton ? 125 : 190 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeIntersection()}>
|
|
141
141
|
{isIntersectionObserver ? (
|
|
142
142
|
<CardContainer
|
|
143
143
|
showAddButton={!hideAddButton}
|