React Native MantineTypography

RollingNumber

Display numbers with a rolling digit animation

Import: import { RollingNumber } from 'react-native-mantine';

Usage

import { RollingNumber } from 'react-native-mantine';

<RollingNumber
  value={value}
  prefix="$ "
  thousandSeparator
  decimalScale={2}
  textStyle={{ fontSize: 28, fontWeight: '700' }}
/>

// Change the value to trigger the rolling animation
setValue(Math.floor(Math.random() * 100000));

Props

PropTypeDefaultDescription
value (required)number | stringValue to display
prefixstringPrefix added before the formatted value (e.g., "
quot;)
suffixstringSuffix added after the formatted value (e.g., " USD")
thousandSeparatorstring | booleanThousands separator, true for "," or any string (e.g., " ", ".")
decimalSeparatorstring"."Decimal separator character
decimalScalenumberLimits the number of digits after the decimal point
fixedDecimalScalebooleanfalseIf true, zeros are added to match decimalScale
animationDurationnumber600Roll animation duration in ms, 0 disables animation
timingFunction'ease' | 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out'"ease"Animation timing function
tabularNumbersbooleantrueIf set, digits use tabular figures to prevent layout shifts
textStyleTextStyleText style applied to every character
styleViewStyleAdditional styles to apply to the root element

Source on GitHub · npm