I am trying sort my array alphabetically.
myArray.sort(function(a, b){
return a.title.localeCompare(b.title ,'tr');
})
myArray includes turkish characters like 'ç,ş,ü,ö,ı'. My code works correctly on ios but it doesn't work the way i want it on android. It sort alphabatically but words starting with turkish characters are at the bottom of list.
I am trying sort my array alphabetically.
myArray.sort(function(a, b){
return a.title.localeCompare(b.title ,'tr');
})
myArray includes turkish characters like 'ç,ş,ü,ö,ı'. My code works correctly on ios but it doesn't work the way i want it on android. It sort alphabatically but words starting with turkish characters are at the bottom of list.
Share Improve this question edited Nov 7, 2018 at 13:45 user asked Nov 7, 2018 at 12:30 useruser 1231 silver badge11 bronze badges2 Answers
Reset to default 6In recent versions of React Native, you can enable Intl support in your Android app by changing the value of jscFlavor
in app/build.gradle
to org.webkit:android-jsc-intl:+
The location to change the value in the gradle file
I'm having the same issue with latest RN 0.61.5
on Android.
I ended up using lodash deburr to remove accented chars from my strings and I then call String.localCompare
on deburred strings. It seems to do the job so far...