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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.16.26",
3
+ "version": "0.16.27",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -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, OIcon } from '../shared';
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
- const SinguleProductCardUI = (props: SingleProductCardParams) => {
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
- <OIcon
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 = {