From fd882830b22537d73c68c81cb80db2c3f5c7a589 Mon Sep 17 00:00:00 2001 From: erwan Date: Fri, 20 Dec 2024 16:45:36 +0100 Subject: [PATCH] fix amount and oldAmount condition and fix hideCents props --- .../react/components/price/Price.native.tsx | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/packages/react/components/price/Price.native.tsx b/packages/react/components/price/Price.native.tsx index 5861acca..be6780d5 100644 --- a/packages/react/components/price/Price.native.tsx +++ b/packages/react/components/price/Price.native.tsx @@ -1,20 +1,12 @@ +import { ComponentName } from '@/components/enumsComponentsName' +import { Spacer, SpacerSize } from '@/components/spacer' +import { StatesContext } from '@/context/providerStates' import React, { useContext, useMemo } from 'react' import { StyleSheet, Text, View } from 'react-native' -import { Text as TrilogyText } from '@/components/text' -import { Spacer, SpacerSize } from '@/components/spacer' -import { PriceProps } from './PriceProps' +import { Alignable, getColorStyle, getTypographyBoldStyle, TrilogyColor, TypographyBold } from '../../objects' import { PriceLevel } from './PriceEnum' -import { - Alignable, - getColorStyle, - getTypographyBoldStyle, - TrilogyColor, - TypographyBold, - TypographyColor, -} from '../../objects' import { checkCents } from './PriceHelpers' -import { ComponentName } from '@/components/enumsComponentsName' -import { StatesContext } from '@/context/providerStates' +import { PriceProps } from './PriceProps' /** * Price Component @@ -276,9 +268,9 @@ const Price = ({ > { <> - {oldAmount && ( + {oldAmount !== undefined && ( - {oldAmount && } + {oldAmount !== undefined && } - €{hideCents && (centsStriked || '00')} + €{!hideCents && (centsStriked || '00')} {mention && mention} @@ -295,15 +287,15 @@ const Price = ({ )} - {amount && oldAmount && } - {amount && ( + {amount !== undefined && oldAmount !== undefined && } + {amount !== undefined && ( {`${whole}`} - €{hideCents && (cents || '00')} + €{!hideCents && (cents || '00')} {mention && mention}