ordering-ui-react-native 0.17.2 → 0.17.3
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
CHANGED
|
@@ -92,6 +92,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
92
92
|
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
|
|
93
93
|
const [comments, setComments] = useState<Array<any>>([])
|
|
94
94
|
const [extraComment, setExtraComment] = useState('')
|
|
95
|
+
const [enableProduct, setEnableProduct] = useState(true)
|
|
95
96
|
|
|
96
97
|
const onSubmit = () => {
|
|
97
98
|
if (Object.values(stars).some((value: any) => value === 0)) {
|
|
@@ -105,6 +106,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
105
106
|
handleReviewState && handleReviewState(order?.id)
|
|
106
107
|
setIsReviewed && setIsReviewed(true)
|
|
107
108
|
setAlertState({ ...alertState, success: true })
|
|
109
|
+
!enableProduct && navigation?.canGoBack() && navigation.goBack()
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
const qualificationList = [
|
|
@@ -141,7 +143,16 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
141
143
|
if (!order?.review) {
|
|
142
144
|
onSubmit()
|
|
143
145
|
} else {
|
|
144
|
-
|
|
146
|
+
skipOrderReview()
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const skipOrderReview = () => {
|
|
151
|
+
if (enableProduct) onNavigationRedirect('ReviewProducts', { order: order })
|
|
152
|
+
else if (order?.driver && !order?.user_review) {
|
|
153
|
+
onNavigationRedirect('ReviewDriver', { order: order })
|
|
154
|
+
} else {
|
|
155
|
+
navigation?.canGoBack() && navigation.goBack()
|
|
145
156
|
}
|
|
146
157
|
}
|
|
147
158
|
|
|
@@ -187,6 +198,10 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
187
198
|
setStars({ ...stars, comments: _comment })
|
|
188
199
|
}, [comments, extraComment])
|
|
189
200
|
|
|
201
|
+
useEffect(() => {
|
|
202
|
+
setEnableProduct(!order?.products.every(product => product?.deleted))
|
|
203
|
+
}, [order])
|
|
204
|
+
|
|
190
205
|
return (
|
|
191
206
|
<>
|
|
192
207
|
<ReviewOrderContainer>
|
|
@@ -296,7 +311,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
296
311
|
<FloatingBottomContainer>
|
|
297
312
|
<ActionContainer>
|
|
298
313
|
<SkipButton
|
|
299
|
-
onPress={() =>
|
|
314
|
+
onPress={() => skipOrderReview()}
|
|
300
315
|
>
|
|
301
316
|
<OText weight={700} size={18} color={theme.colors.textNormal}>{t('FRONT_VISUALS_SKIP', 'Skip')}</OText>
|
|
302
317
|
</SkipButton>
|
|
@@ -74,7 +74,7 @@ const ReviewProductsUI = (props: ReviewProductParams) => {
|
|
|
74
74
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
75
75
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
76
76
|
/>
|
|
77
|
-
{order?.products?.map((product: any) => (
|
|
77
|
+
{order?.products?.map((product: any) => !product?.deleted && (
|
|
78
78
|
<SingleProductReview
|
|
79
79
|
key={product.id}
|
|
80
80
|
product={product}
|