ordering-ui-react-native 0.16.26 → 0.16.27
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
|
@@ -9,13 +9,20 @@ import {
|
|
|
9
9
|
import { useTheme } from 'styled-components/native';
|
|
10
10
|
import { SingleProductCardParams } from '../../types';
|
|
11
11
|
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
|
|
12
|
-
import { StyleSheet, View, TouchableOpacity } from 'react-native';
|
|
13
|
-
import { OText
|
|
12
|
+
import { StyleSheet, View, TouchableOpacity, Image } from 'react-native';
|
|
13
|
+
import { OText } from '../shared';
|
|
14
14
|
import FastImage from 'react-native-fast-image'
|
|
15
15
|
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
16
16
|
import { shape } from '../../utils';
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
function SingleProductCardPropsAreEqual(prevProps: any, nextProps: any) {
|
|
19
|
+
return JSON.stringify(prevProps.product) === JSON.stringify(nextProps.product) &&
|
|
20
|
+
prevProps.isSoldOut === nextProps.isSoldOut &&
|
|
21
|
+
prevProps.productAddedToCartLength === nextProps.productAddedToCartLength &&
|
|
22
|
+
prevProps.categoryState === nextProps.categoryState
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
19
26
|
const {
|
|
20
27
|
product,
|
|
21
28
|
isSoldOut,
|
|
@@ -188,9 +195,13 @@ const SinguleProductCardUI = (props: SingleProductCardParams) => {
|
|
|
188
195
|
resizeMode={FastImage.resizeMode.cover}
|
|
189
196
|
/>
|
|
190
197
|
) : (
|
|
191
|
-
<
|
|
192
|
-
src={theme?.images?.dummies?.product}
|
|
198
|
+
<FastImage
|
|
193
199
|
style={styles.productStyle}
|
|
200
|
+
source={{
|
|
201
|
+
uri: Image.resolveAssetSource(theme.images.dummies.product).uri,
|
|
202
|
+
priority: FastImage.priority.normal,
|
|
203
|
+
}}
|
|
204
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
194
205
|
/>
|
|
195
206
|
)}
|
|
196
207
|
</LogoWrapper>
|
|
@@ -204,7 +215,7 @@ const SinguleProductCardUI = (props: SingleProductCardParams) => {
|
|
|
204
215
|
)}
|
|
205
216
|
</CardContainer>
|
|
206
217
|
);
|
|
207
|
-
};
|
|
218
|
+
}, SingleProductCardPropsAreEqual);
|
|
208
219
|
|
|
209
220
|
export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
210
221
|
const singleProductCardProps = {
|