Registry / ecommerce / react-native-currency-formatter

react-native-currency-formatter

JSON →
library1.0.3jsnpmunverified

A lightweight React Native library for formatting currency values as IDR (Indonesian Rupiah) and USD (US Dollar). Current stable version is 1.0.3, updated infrequently (last commit in 2019). Key differentiators: simple API, automatic rounding of IDR values to nearest integer, and configurable decimal/thousand separators. However, it lacks modern ESM support, TypeScript definitions, and active maintenance. Alternatives like 'react-native-currency-input' offer more features and active development.

npm install react-native-currency-formatter
INSTALL
IMPORT
SIG · REACT-NATIVE-CURRE
R
react-native-currency-formatter
ecommercejavascriptv1.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CurrencyFormatter
import CurrencyFormatter from 'react-native-currency-formatter';
const CurrencyFormatter = require('react-native-currency-formatter');
Default export; CommonJS require also works but not recommended for newer React Native projects.

Basic usage of CurrencyFormatter to format a number as IDR or USD based on configuration in the source file (default: IDR with left position).

import React from 'react'; import { Text, View } from 'react-native'; import CurrencyFormatter from 'react-native-currency-formatter'; export default function App() { const value = 1234511.47; const formatted = CurrencyFormatter(value); return ( <View> <Text>{formatted}</Text> </View> ); }
Debug
Known issues
deprecatedPackage not updated since 2019; may not work with latest React Native versions.
fix
Consider migrating to a maintained alternative like 'react-native-currency-input' or use Intl.NumberFormat.
affects: *
gotchaThe library does not export any types; TypeScript users will need to declare a module or cast to 'any'.
fix
Add a type declaration: declare module 'react-native-currency-formatter';
affects: *
gotchaFormatting is hardcoded to IDR or USD via source code modification; no runtime configuration API.
fix
Edit node_modules/react-native-currency-formatter/index.js to change currency settings, then use patch-package to persist changes.
affects: *
gotchaThe library only supports IDR and USD; attempting to use other currencies will not work without source modification.
fix
If other currencies needed, switch to a more flexible library like 'intl' or 'currency.js'.
affects: *
deprecatedNo CommonJS or UMD build; requires React Native Metro bundler.
fix
Ensure you are using a React Native environment; not suitable for plain React web apps.
affects: *
Errors
Common errors & fixes
TypeError: CurrencyFormatter is not a function
Using named import instead of default import.
fix
Change import to: import CurrencyFormatter from 'react-native-currency-formatter';
Invalid currency code provided.
Attempting to set currencyCode to a value other than 'IDR ' or 'USD ' with trailing space in source file.
fix
In node_modules/react-native-currency-formatter/index.js, set currencyCode to 'IDR ' (note trailing space) or 'USD '.
Cannot read property 'format' of undefined
Using the library outside of React Native environment (e.g., Node.js or browser without polyfill).
fix
Ensure the code runs in React Native; or provide a polyfill for Number.prototype.toLocaleString if in other environment.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
20
Resources
react-native-currency-formatter — npm install react-native-currency-formatter · libregistry