Design
I built react-native-naira-utils so you don't have to hand-roll Naira formatting again
Every Nigerian fintech or e-commerce app built in React Native eventually needs the same handful of things: format an amount in Naira, validate a phone number, build a USSD string, check that a bank account number is well-formed. And every single time, someone on the team writes a slightly different, slightly buggy version of it from scratch.
I got tired of that, so I built react-native-naira-utils — a small, dependency-light, fully-tested TypeScript package that handles it once, properly.
What's in it:
Currency — formatNaira(), parseNaira(), and toKobo()/fromKobo() for converting cleanly to the integer-kobo format that payment APIs like Paystack and Flutterwave expect, without the floating-point rounding bugs that plague naive amount * 100 conversions.
Phone numbers — isValidNGPhone(), formatNGPhone(), and detectNetwork(), which normalizes any of the common Nigerian phone formats and gives a best-effort MTN/Glo/Airtel/9mobile guess based on prefix.
USSD — buildUSSD() and dialUSSD(), which handle the fiddly tel: URL-encoding quirks around * and # that trip people up on Android.
NUBAN validation — isValidNUBAN() and computeNUBANCheckDigit(), implementing the actual CBN check-digit algorithm (verified against the official worked example in the CBN specification, not reverse-engineered from guesswork), plus a bundled list of ~40 Nigerian banks, microfinance banks, and fintechs.
Why it matters:
None of this is hard, exactly — but it's the kind of code that's easy to get subtly wrong (floating-point kobo conversion, USSD encoding on Android, NUBAN checksum weights), and every team ends up re-solving it. Centralizing it in one well-tested package means you get it right once and move on to the actual product.
It's pure JavaScript/TypeScript — no native modules — so it works with both bare React Native and Expo out of the box.
Try it:
bash
npm install react-native-naira-utils
ts
import { formatNaira, isValidNGPhone, isValidNUBAN } from 'react-native-naira-utils';
formatNaira(1200.5); // "₦1,200.50"
isValidNGPhone('08031234567'); // true
isValidNUBAN('0016563228', '058'); // true
Full docs and examples are on [https://github.com/okewunmi/npm-react-native-naira-utils] / [https://www.npmjs.com/package/react-native-naira-utils].
This is v1 — I'd genuinely appreciate issues, PRs, or just a note about what you needed that wasn't there. Building it once for the whole community is the whole point.
