@propel-nsl/propel-react-native-sdk 1.2.1 → 1.2.2

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": "@propel-nsl/propel-react-native-sdk",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Propel Mobile SDK - React Native Core",
5
5
  "files": [
6
6
  "src/",
@@ -283,6 +283,8 @@ const Dashboard: React.FC<Props> = ({ navigation }) => {
283
283
  navigateToDashboardScreen("MyCart", { from: "Dashboard" });
284
284
  };
285
285
 
286
+ const cartItemCount = viewMyCartData?.items?.length || 0;
287
+
286
288
  // Categories data with actual images
287
289
  const categoriesData = [
288
290
  { id: "1", name: "Apparel", image: Images.categoryApparel },
@@ -358,11 +360,11 @@ const Dashboard: React.FC<Props> = ({ navigation }) => {
358
360
  style={styles.cartButton}
359
361
  onPress={() => navigateToCart()}
360
362
  >
361
- <View style={styles.cartCountContainer}>
362
- <Text style={styles.cartCountText}>
363
- {viewMyCartData?.items?.length || 0}
364
- </Text>
365
- </View>
363
+ {cartItemCount > 0 && (
364
+ <View style={styles.cartCountContainer}>
365
+ <Text style={styles.cartCountText}>{cartItemCount}</Text>
366
+ </View>
367
+ )}
366
368
  <CustomImage source={Images.cart} imgStyle={styles.headerIcon} />
367
369
  </TouchableOpacity>
368
370
  </View>
@@ -481,6 +481,7 @@ const ProductDetail: React.FC = () => {
481
481
  ).trim();
482
482
 
483
483
  const shrinkLabel = isPureText(variantLabel);
484
+ const cartItemCount = viewMyCartData?.items?.length || 0;
484
485
 
485
486
  return (
486
487
  <SafeAreaView style={styles.container}>
@@ -498,11 +499,11 @@ const ProductDetail: React.FC = () => {
498
499
  style={styles.cartButton}
499
500
  onPress={() => navigateToCart()}
500
501
  >
501
- <View style={styles.cartCountContainer}>
502
- <Text style={styles.cartCountText}>
503
- {viewMyCartData?.items?.length || 0}
504
- </Text>
505
- </View>
502
+ {cartItemCount > 0 && (
503
+ <View style={styles.cartCountContainer}>
504
+ <Text style={styles.cartCountText}>{cartItemCount}</Text>
505
+ </View>
506
+ )}
506
507
  <CustomImage source={Images.cart} imgStyle={styles.cartIcon} />
507
508
  </TouchableOpacity>
508
509
  </View>
@@ -259,6 +259,8 @@ const Redeem: React.FC = () => {
259
259
  navigation.navigate(ROUTES.MyCart as any, { from: ROUTES.REDEEM });
260
260
  };
261
261
 
262
+ const cartItemCount = viewMyCartData?.items?.length || 0;
263
+
262
264
  return (
263
265
  <SafeAreaView style={styles.container}>
264
266
  <View style={styles.headerSection}>
@@ -271,11 +273,11 @@ const Redeem: React.FC = () => {
271
273
  style={styles.cartButton}
272
274
  onPress={navigateToCart}
273
275
  >
274
- <View style={styles.cartCountContainer}>
275
- <Text style={styles.cartCountText}>
276
- {viewMyCartData?.items?.length || 0}
277
- </Text>
278
- </View>
276
+ {cartItemCount > 0 && (
277
+ <View style={styles.cartCountContainer}>
278
+ <Text style={styles.cartCountText}>{cartItemCount}</Text>
279
+ </View>
280
+ )}
279
281
  <CustomImage source={Images.cart} imgStyle={styles.cartIcon} />
280
282
  </TouchableOpacity>
281
283
  </View>