Skip to content

Reward Tile

A compound component that displays reward information with configurable media, title, description, points, and navigation elements.

⚠️ Important: This component requires the WllSdkContext to be properly set up in the parent tree. The component supports both full and half-height layouts.

Usage

jsx
import { RewardTile } from '@wlloyalty/wll-react-native-sdk'

const tile = {
  type: 'REWARD',
  tileHeight: 'FULL',
  configuration: {
    name: 'Sweet Chilli Lobster Noodles',
    pictureUrl: 'https://example.com/noodles.jpg',
    price: 800,
    showPrice: true,
    showArtwork: true,
    summary: 'Delicious noodles with fresh lobster',
    pointsMultiplier: '1',
    pointsPrefix: '$',
    pointsSuffix: 'pts'
  }
}

function MyComponent() {
  return <RewardTile tile={tile} />
}

Props

NameTypeRequiredDescription
tileTileYesReward tile configuration object

Subcomponents

ComponentDescription
RewardTile.MediaDisplays reward image
RewardTile.TitleShows reward name
RewardTile.DescriptionRenders reward summary
RewardTile.PointsShows calculated points with prefix/suffix
RewardTile.ChevronNavigation indicator
RewardTile.ContentContent wrapper with padding

Configuration Object

PropertyTypeDescription
namestringReward title
pictureUrlstringImage URL
pricenumberReward price
showPricebooleanWhether to display price
showArtworkbooleanWhether to display image
summarystringDescription text
pointsMultiplierstringPoints calculation multiplier
pointsPrefixstringPoints display prefix
pointsSuffixstringPoints display suffix

Styling

The component uses responsive styles with:

  • 50% flex basis for image container
  • Responsive padding and margins
  • Configurable image resize mode
  • Responsive text sizes
  • Theme-based colors

States

  • With Media: Displays image when pictureUrl is provided
  • With Points: Shows calculated points when price and showPrice are true
  • Without Description: Hides description when summary is missing
  • Without Price: Hides points when price is 0 or showPrice is false

Points Calculation

Points are calculated using:

typescript
calculatedPoints = price * (Number(pointsMultiplier) || 1)

Example Response Structure

typescript
{
  tileHeight: 'FULL',
  active: true,
  type: 'REWARD',
  configuration: {
    name: 'Sweet Chilli Lobster Noodles',
    pictureUrl: 'https://example.com/noodles.jpg',
    price: 800,
    showPrice: true,
    showArtwork: true,
    summary: 'Delicious noodles with fresh lobster',
    pointsMultiplier: '1',
    pointsPrefix: '$',
    pointsSuffix: 'pts'
  },
  priority: 3
}

Released under the MIT License.