reactjsreact-nativereact-native-contacts

How to load contacts alphabetically in react native?


I am creating a react native app to load phone book contacts to my app using this library. I loaded contact correctly in my app. But contacts not in alphabetically order. Now I wanted to load contacts alphabetically order. How can I do that?

This is the error after adding sorting part.


Solution

  • Const tmpArray = _.sortBy(arrFinal, 'fullname')thanthis.setState({ contactList: tmpArray, isLoading: false })`