-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
localeCompare is wrong in Android vs iOS #12597
Comments
Can you try if it's different between iOS 8 and 10? JavaScriptCore version on Android is locked as FB built it from a commit from WebKit repo close to iOS 8 branch, and never changed it. If there's a change in |
react-native does not use v8 on Android by the way, so that's irrelevant. |
Yes, you are right I totally forgot it uses JavaScriptCore. I've checked with an iOS 8.1 and it returns 1 too, so it's also broken. So as you say, there is a difference between iOS 8 and 10. Because my previous tests were in an iOS 10.2. So, the only fix would be to update WebKit version for Android in RN, which sound like a hot potato. Anyone knows a workaround to sort international strings? Thanks, cheers |
I see this polyfill https://github.com/kosmobot/locale-compare-polyfill but
|
@christopherdro This does not look to be Android specific issue, it's related to JavaScriptCore versions. The 'Android' label will be misleading. |
Is there a workaround for this problem now? |
@maraujop @feisan Looks like FB is building a new version of JSC for Android https://github.com/SoftwareMansion/jsc-android-buildscripts The README says there's support for more i18n support, but the trade-off is that your apk binary will grow in size. (For iOS 8, no solution) |
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally! If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution. |
The issue is closed, but is this ever going to be addressed in RN or are we supposed to build our own version of JSC and distribute it with our Apps??? |
Description
It seems that
localeCompare
works differently in iOS and Android. In Android it doesn't return the expected value.Reproduction
In Google Chrome in Mac returns 0
in Android 6.0.1 react-native (device and emulator) returns 1
in iOS 10.2 react-native returns 0
It's my understanding that
localeCompare
is not reliable in Android for anything that is not English. I don't know if this is an error in v8 engine, but I believe this was patched in v8-i18n, so not sure if this can be fixed in RN or notAdditional Information
The text was updated successfully, but these errors were encountered: