How to use Intl.NumberFormat with react native?
Asked Answered
D

2

9

Im trying to convert a number to price format in react native. How to use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat (Intl.NumberFormat) this with react native?

Dortheydorthy answered 15/10, 2018 at 8:40 Comment(0)
V
3

Looks like you need the international version of JSC: Android: https://github.com/react-native-community/jsc-android-buildscripts#international-variant

For iOS you'd need to use Intl.js polyfill https://github.com/andyearnshaw/Intl.js/

Vyborg answered 11/9, 2019 at 3:1 Comment(2)
Is there any plugin available ?Beefwitted
you can use JS polyfill(for default JS engine on Android): gist.github.com/evasyuk/e05c230afa578fe42f95e4d8b004356fCourtund
S
-1

Simply install the intl package for expo building on android. Then you can use the Intl.NumberFormat as described in the Mozilla Docs.

Sublett answered 16/12, 2022 at 14:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.