{"id":41837,"library":"react-native-format-currency","title":"react-native-format-currency","description":"A lightweight, zero-dependency currency formatter for React Native and Expo built with TypeScript. It supports 165+ ISO 4217 currency codes and provides correct symbol placement, thousands/decimal separators, and negative amount formatting. The library returns both symbol-prefixed and plain values as an array or object. Caching via an internal LRU cache (max 100 entries) ensures fast repeated calls. Unlike locale-based formatters, this uses pre-defined rules for each currency. Stable v1.0.0 — released with minimal breaking changes expected.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/AwesomeLabs/react-native-format-currency","tags":["javascript","react-native","react native","reactnative","expo","ios","android","currency","formatter","typescript"],"install":[{"cmd":"npm install react-native-format-currency","lang":"bash","label":"npm"},{"cmd":"yarn add react-native-format-currency","lang":"bash","label":"yarn"},{"cmd":"pnpm add react-native-format-currency","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export does not exist; use named import.","wrong":"import formatCurrency from 'react-native-format-currency'","symbol":"formatCurrency","correct":"import { formatCurrency } from 'react-native-format-currency'"},{"note":"ESM import is preferred; require works but is less common for TypeScript.","wrong":"const getSupportedCurrencies = require('react-native-format-currency').getSupportedCurrencies","symbol":"getSupportedCurrencies","correct":"import { getSupportedCurrencies } from 'react-native-format-currency'"},{"note":"CURRENCIES is a named export containing full currency configurations.","wrong":null,"symbol":"CURRENCIES","correct":"import { CURRENCIES } from 'react-native-format-currency'"}],"quickstart":{"code":"import { formatCurrency, getSupportedCurrencies } from 'react-native-format-currency';\n\nconst [withSymbol, withoutSymbol, symbol] = formatCurrency({\n  amount: 1234.56,\n  code: 'USD',\n});\nconsole.log(withSymbol); // '$1,234.56'\n\n// Object return type\nconst result = formatCurrency({ amount: 1234.56, code: 'USD', returnType: 'object' });\n// { formatted: '$1,234.56', value: '1,234.56', symbol: '$' }\n\n// List all supported currencies\nconst currencies = getSupportedCurrencies();\nconsole.log(currencies.length); // 165+","lang":"typescript","description":"Shows basic usage of formatCurrency with array and object return types, and how to list supported currencies."},"warnings":[{"fix":"If locale-aware formatting is needed, consider using Intl.NumberFormat instead.","message":"formatCurrency does not accept a locale argument; formatting is based solely on internal currency rules (symbol, separators, etc.) and may not match user's locale expectations.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use integers for cents (e.g., 123456 for $1,234.56) and multiply/divide accordingly before formatting.","message":"Amounts are passed as numbers; floating-point rounding may occur. For precise formatting (e.g., cents), pass an integer and divide/round prior.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set returnType to 'object' if you prefer destructuring named properties.","message":"returnType: 'array' is the default but can be explicitly set; use 'object' for readability.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'100':61 '165':23 '4217':25 'amount':37 'android':98 'array':51 'base':70 'break':86 'built':18 'cach':54,59 'call':66 'chang':87 'code':27 'correct':30 'currenc':5,11,26,80,99 'defin':76 'depend':10 'ensur':63 'entri':62 'expect':88 'expo':17,96 'fast':64 'format':4,38 'formatt':12,71,100 'intern':57 'io':97 'iso':24 'javascript':89 'librari':40 'lightweight':7 'local':69 'locale-bas':68 'lru':58 'max':60 'minim':85 'nativ':3,15,92,94 'negat':36 'object':53 'placement':32 'plain':47 'pre':75 'pre-defin':74 'prefix':45 'provid':29 'react':2,14,91,93 'react-nat':90 'react-native-format-curr':1 'reactnat':95 'releas':83 'repeat':65 'return':41 'rule':77 'separ':34 'stabl':81 'support':22 'symbol':31,44 'symbol-prefix':43 'thousands/decimal':33 'typescript':20,101 'unlik':67 'use':73 'v1.0.0':82 'valu':48 'via':55 'zero':9 'zero-depend':8","created_at":"2026-06-04T18:54:20.714180+00:00","updated_at":"2026-06-04T18:54:20.714180+00:00","problems":[{"fix":"Run 'npm install react-native-format-currency' (or yarn/pnpm) and ensure tsconfig.json includes 'node_modules' in moduleResolution.","cause":"Package not installed or TypeScript cannot resolve the module path.","error":"Cannot find module 'react-native-format-currency' or its corresponding type declarations."},{"fix":"Change 'import f from ...' to 'import { formatCurrency } from ...'","cause":"Using default import instead of named import.","error":"Property 'formatCurrency' does not exist on type 'typeof import(\"react-native-format-currency\")'."},{"fix":"Use formatCurrency({ amount: 1234.56, code: 'USD' })","cause":"A caller used formatCurrency(amount, code) as separate arguments instead of an options object.","error":"Expected 0 arguments, but got 1."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/AwesomeLabs/react-native-format-currency#readme","github":"https://github.com/AwesomeLabs/react-native-format-currency","docs":null,"changelog":null,"pypi":null,"npm":"react-native-format-currency","openapi_spec":null,"status_page":null,"smithery":null,"categories":["payments"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}