1

I need to change a number to currency format in React-Native this doesn't work in my case:

import Numeral from "numeral";
Numeral(100).format("$0.00")

it outputs: Metro Bundler has encountered an internal error. I know Numeral is not built for React-Native, but is there a workaround or any alternative?

DennyHiu
  • 4,861
  • 8
  • 48
  • 80
  • the documentation states (http://numeraljs.com/#use-it): `npm install numeral --dev` and then `const Numeral = require('numeral');`. – Samuli Hakoniemi Jul 27 '18 at 23:08

1 Answers1

2

Here is the step to use numeral library:

  1. Do npm install --save numeral in your application folder
  2. Import the numeral library like this import numeral from 'numeral'
  3. Use it in the place that you want to put it like this numeral(100).format('$0,0.00')

You can see another type of format and documentation from the website http://numeraljs.com/

Timothy Alfares
  • 297
  • 1
  • 6