react-native-currency-formatter

1.0.3 • Public • Published

react-native-currency-formatter

Javascript - React Native

Currency Formatter Rupiah Indonesia and US Dollar


This is the JavaScript widget used only IDR and USD, you can change according to your needs. If you use for IDR, the value or price is automatically round a number upward to its nearest integer:

This widget has implemented in React Native version 0.53.0.

HOW TO USE

Installation

npm i react-native-currency-formatter

Configuration

Config the currency

const currencyCode = 'IDR '; // IDR or USD
const currencyPosition = 'left' // left or right
const maxFractionDigits = 2;
const decimalSeparator = ',';
const thousandSeparator = '.'; 

Usage

  • Create file CurrencyFormatter in your folder project.
  • import in your components import CurrencyFormatter from '_YOUR_ROOT_FILE/CurrencyFormatter';
  • call the formatter ${ CurrencyFormatter(value_of_price) }

EXAMPLE

For IDR (Indonesian Rupiah)
  • ${ CurrencyFormatter(1234511) }
  • Result IDR 1.234.511
For US Dollar
  • ${ CurrencyFormatter(1234511.47) }
  • Result IDR 1,234,511.47

Package Sidebar

Install

npm i react-native-currency-formatter

Weekly Downloads

16

Version

1.0.3

License

ISC

Unpacked Size

21.7 kB

Total Files

4

Last publish

Collaborators

  • haifahrul