Open mcuelenaere opened 2 years ago
Facing the same issue
Facing the same issue
The same issue , do you have any solution?
I apologise we haven't previously responded here. Hermes Intl has been implemented on top of platform APIs which means that it isn't always possible to implement the entirety of Intl, and we've run into problems with varying support on different platforms and versions.
We have plans to migrate our implementation to provide a more feature rich implementation (see the discussion in https://github.com/facebook/hermes/discussions/1211).
Bug Description
gradle clean
and confirmed this bug does not occur with JSCHermes version: 0.8.1 React Native version (if any): 0.65.1 OS version (if any): Android 10 Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): n/a
Steps To Reproduce
console.log(new Intl.NumberFormat('en', { currencyDisplay: 'narrowSymbol', style: 'currency', currency: 'USD' }).format(100));
100 US$
being displayedThe Expected Behavior
$100
Fix
I've traced this down to https://github.com/facebook/hermes/blob/main/lib/Platform/Intl/java/com/facebook/hermes/intl/PlatformNumberFormatterICU.java#L73-L74 calling https://github.com/facebook/hermes/blob/main/lib/Platform/Intl/java/com/facebook/hermes/intl/IPlatformNumberFormatter.java#L213-L219, which does not use https://developer.android.com/reference/android/icu/util/Currency#NARROW_SYMBOL_NAME (which is only available on API>=30).
I could make a rudimentary PR for this, but since we'll be going with a different approach in our project (we need to support Android devices older than 11), I won't be able to validate/test the PR. So instead I created this issue so others have a good starting point if they would want to fix this issue.