Skip to content

Commit

Permalink
Merge pull request #65 from white-label-loyalty/fix/text-strings-must…
Browse files Browse the repository at this point in the history
…-be-rendered-within-a-component

fix: (RewardTile) fixes issue in react native mobile with strings bei…
  • Loading branch information
iamgraeme authored Jan 1, 2025
2 parents fcfbf6c + 66ad21f commit 6447b06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const PointsTileFormattedPoints = (): JSX.Element | null => {
} = configuration as PointsTileConfig;

if (points === undefined) return null;
const calculatedPoints = points * multiplier;
const calculatedPoints = points * Number(multiplier ?? 1);
const fullPointsText = `${pointsPrefix}${calculatedPoints} ${pointsSuffix}`;

return (
Expand Down
8 changes: 4 additions & 4 deletions lib/components/organisms/RewardTile/reward-tile-points.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const RewardTilePoints = (): JSX.Element | null => {
if (!showPrice || price === undefined) return null;

// Calculate points
const calculatedPoints = price * Number(pointsMultiplier);
const calculatedPoints = price * Number(pointsMultiplier ?? 1);
const fullPointsText = `${pointsPrefix}${calculatedPoints} ${pointsSuffix}`;

return (
Expand All @@ -29,15 +29,15 @@ export const RewardTilePoints = (): JSX.Element | null => {
accessibilityRole="text"
accessibilityLabel={`Reward points: ${fullPointsText}`}
>
<Text
variant="caption"
<Text
variant="caption"
style={styles.footer}
accessibilityElementsHidden={true}
importantForAccessibility="no-hide-descendants"
>
{pointsPrefix}
<View style={styles.pointsContainer}>
{calculatedPoints}
<Text variant="caption">{calculatedPoints}</Text>
<Text style={styles.suffix}>{pointsSuffix}</Text>
</View>
</Text>
Expand Down

0 comments on commit 6447b06

Please sign in to comment.