ordering-ui-react-native 0.17.27 → 0.17.28
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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState, useCallback } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
View,
|
|
4
|
+
Keyboard,
|
|
5
|
+
TextInput,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
Dimensions,
|
|
9
|
+
I18nManager,
|
|
10
|
+
SafeAreaView,
|
|
11
|
+
Platform,
|
|
12
|
+
Button
|
|
13
13
|
} from 'react-native';
|
|
14
14
|
import {
|
|
15
15
|
ProductForm as ProductOptions,
|
|
@@ -459,13 +459,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
useEffect(() => {
|
|
462
|
-
|
|
462
|
+
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
463
463
|
scrollViewRef.current.scrollToEnd({ animated: true })
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
464
|
+
})
|
|
465
|
+
return () => {
|
|
466
|
+
keyboardDidShowListener.remove()
|
|
467
|
+
}
|
|
468
|
+
}, [])
|
|
469
469
|
|
|
470
470
|
|
|
471
471
|
return (
|
|
@@ -530,7 +530,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
530
530
|
>
|
|
531
531
|
{String(img).includes('image') ? (
|
|
532
532
|
<FastImage
|
|
533
|
-
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
|
|
533
|
+
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 3 / 2 }}
|
|
534
534
|
source={{
|
|
535
535
|
uri: optimizeImage(img, 'h_1024,c_limit'),
|
|
536
536
|
priority: FastImage.priority.normal,
|
|
@@ -1054,7 +1054,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1054
1054
|
width={16}
|
|
1055
1055
|
color={
|
|
1056
1056
|
maxProductQuantity <= 0 ||
|
|
1057
|
-
|
|
1057
|
+
(productCart?.quantity + productAddedToCartLength) >= maxProductQuantity ||
|
|
1058
1058
|
((productCart?.quantity + productAddedToCartLength) >= product?.maximum_per_order && product?.maximum_per_order) ||
|
|
1059
1059
|
isSoldOut
|
|
1060
1060
|
? theme.colors.backgroundGray
|
|
@@ -1108,20 +1108,20 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1108
1108
|
|
|
1109
1109
|
|
|
1110
1110
|
export const ProductForm = (props: any) => {
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1111
|
+
const productOptionsProps = {
|
|
1112
|
+
...props,
|
|
1113
|
+
productCart: {
|
|
1114
|
+
...props.productCart,
|
|
1115
|
+
quantity: props.productCart?.code
|
|
1116
|
+
? props.productCart?.quantity
|
|
1117
|
+
: props?.product?.minimum_per_order || 1
|
|
1118
|
+
},
|
|
1119
|
+
UIComponent: ProductOptionsUI
|
|
1120
|
+
}
|
|
1121
1121
|
|
|
1122
|
-
|
|
1122
|
+
return <ProductOptions {...productOptionsProps} />
|
|
1123
1123
|
};
|
|
1124
1124
|
|
|
1125
1125
|
ProductForm.defaultProps = {
|
|
1126
|
-
|
|
1126
|
+
productAddedToCartLength: 0
|
|
1127
1127
|
}
|