简体   繁体   English

如何将 Intl.NumberFormat 与本机反应一起使用?

[英]How to use Intl.NumberFormat with react native?

Im trying to convert a number to price format in react native.我试图在 React Native 中将数字转换为价格格式。 How to use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat (Intl.NumberFormat) this with react native?如何将https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat (Intl.NumberFormat) 与本机反应一起使用?

Looks like you need the international version of JSC: Android: https://github.com/react-native-community/jsc-android-buildscripts#international-variant 看起来你需要国际版的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/ 对于iOS,您需要使用Intl.js polyfill https://github.com/andyearnshaw/Intl.js/

Simply install the intl package for expo building on android.只需安装用于在 android 上构建 expo 的intl 包 Then you can use the Intl.NumberFormat as described in the Mozilla Docs.然后您可以使用 Mozilla 文档中描述的 Intl.NumberFormat。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM