Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native localeCompare not working on Android

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.

like image 938
user Avatar asked Oct 16 '22 11:10

user


1 Answers

In 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

like image 110
Rob Walker Avatar answered Nov 15 '22 06:11

Rob Walker