Sorting contacts in alphabetical order in React-NativeHow do you debug React Native?Hide keyboard in react-nativeHow to do logging in React Native?What is the difference between using constructor vs getInitialState in React / React Native?React Native android build failed. SDK location not found100% width in React Native FlexboxDisabling buttons on react nativeHow to add icons to React Native appWhat is the difference between React Native and React?Error Running React Native App From Terminal (iOS)

Meaning of "legitimate" in Carl Jung's quote "Neurosis is always a substitute for legitimate suffering."

Will consteval functions allow template parameters dependent on function arguments?

Polynomial division: Is this trick obvious?

How to describe a building set which is like LEGO without using the "LEGO" word?

How to continually let my readers know what time it is in my story, in an organic way?

What color to choose as "danger" if the main color of my app is red

What metal is most suitable for a ladder submerged in an underground water tank?

Slice a list based on an index and items behind it in python

How to rename multiple files in a directory at the same time

Testing if os.path.exists with ArcPy?

Understanding Python syntax in lists vs series

Does the wearer know what items are in which patch in the Robe of Useful items?

Holding rent money for my friend which amounts to over $10k?

Why when I add jam to my tea it stops producing thin "membrane" on top?

Will the volt, ampere, ohm or other electrical units change on May 20th, 2019?

How will the lack of ground stations affect navigation?

Formal Definition of Dot Product

Does addError() work outside of triggers?

How to redirect stdout to a file, and stdout+stderr to another one?

Is the seat-belt sign activation when a pilot goes to the lavatory standard procedure?

Was the dragon prowess intentionally downplayed in S08E04?

UUID type for NEWID()

Capital gains on stocks sold to take initial investment off the table

Getting a similar picture (colours) on Manual Mode while using similar Auto Mode settings (T6 and 40D)



Sorting contacts in alphabetical order in React-Native


How do you debug React Native?Hide keyboard in react-nativeHow to do logging in React Native?What is the difference between using constructor vs getInitialState in React / React Native?React Native android build failed. SDK location not found100% width in React Native FlexboxDisabling buttons on react nativeHow to add icons to React Native appWhat is the difference between React Native and React?Error Running React Native App From Terminal (iOS)






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















Currently I'm working on a mobile app. I need to pull contacts from my phone into the app I'm creating (I use expo contacts). For some reason, instead of contacts being sorted in the alphabetical order, they show up in the random order.



I'm not quite sure how to sort the contacts to display them in the alphabetical order.



Can anyone please take a look and let me know what I'm doing wrong/what I should add?



The code that I use:



// load contacts from phone

_loadContacts = async () => {
try {
await Permissions.askAsync(Permissions.CONTACTS);
const data: contacts = await Contacts.getContactsAsync( fields: [Contacts.Fields.PhoneNumbers] )


// for rendering contacts

_renderContact = ( item: firstName, lastName, name, phoneNumbers ) => (
<View style=styles.contact>
<Text style=styles.contactName>name </Text>
<Text style=styles.phoneNumbers>📞 phoneNumbers ? phoneNumbers.map(entry => entry.number).join(", ") : "undefined"</Text>
</View>
)









share|improve this question

















  • 1





    What is the structure of contacts data ??

    – pritesh
    Mar 23 at 15:41

















1















Currently I'm working on a mobile app. I need to pull contacts from my phone into the app I'm creating (I use expo contacts). For some reason, instead of contacts being sorted in the alphabetical order, they show up in the random order.



I'm not quite sure how to sort the contacts to display them in the alphabetical order.



Can anyone please take a look and let me know what I'm doing wrong/what I should add?



The code that I use:



// load contacts from phone

_loadContacts = async () => {
try {
await Permissions.askAsync(Permissions.CONTACTS);
const data: contacts = await Contacts.getContactsAsync( fields: [Contacts.Fields.PhoneNumbers] )


// for rendering contacts

_renderContact = ( item: firstName, lastName, name, phoneNumbers ) => (
<View style=styles.contact>
<Text style=styles.contactName>name </Text>
<Text style=styles.phoneNumbers>📞 phoneNumbers ? phoneNumbers.map(entry => entry.number).join(", ") : "undefined"</Text>
</View>
)









share|improve this question

















  • 1





    What is the structure of contacts data ??

    – pritesh
    Mar 23 at 15:41













1












1








1








Currently I'm working on a mobile app. I need to pull contacts from my phone into the app I'm creating (I use expo contacts). For some reason, instead of contacts being sorted in the alphabetical order, they show up in the random order.



I'm not quite sure how to sort the contacts to display them in the alphabetical order.



Can anyone please take a look and let me know what I'm doing wrong/what I should add?



The code that I use:



// load contacts from phone

_loadContacts = async () => {
try {
await Permissions.askAsync(Permissions.CONTACTS);
const data: contacts = await Contacts.getContactsAsync( fields: [Contacts.Fields.PhoneNumbers] )


// for rendering contacts

_renderContact = ( item: firstName, lastName, name, phoneNumbers ) => (
<View style=styles.contact>
<Text style=styles.contactName>name </Text>
<Text style=styles.phoneNumbers>📞 phoneNumbers ? phoneNumbers.map(entry => entry.number).join(", ") : "undefined"</Text>
</View>
)









share|improve this question














Currently I'm working on a mobile app. I need to pull contacts from my phone into the app I'm creating (I use expo contacts). For some reason, instead of contacts being sorted in the alphabetical order, they show up in the random order.



I'm not quite sure how to sort the contacts to display them in the alphabetical order.



Can anyone please take a look and let me know what I'm doing wrong/what I should add?



The code that I use:



// load contacts from phone

_loadContacts = async () => {
try {
await Permissions.askAsync(Permissions.CONTACTS);
const data: contacts = await Contacts.getContactsAsync( fields: [Contacts.Fields.PhoneNumbers] )


// for rendering contacts

_renderContact = ( item: firstName, lastName, name, phoneNumbers ) => (
<View style=styles.contact>
<Text style=styles.contactName>name </Text>
<Text style=styles.phoneNumbers>📞 phoneNumbers ? phoneNumbers.map(entry => entry.number).join(", ") : "undefined"</Text>
</View>
)






react-native






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 23 at 15:17









andriyanayandriyanay

61




61







  • 1





    What is the structure of contacts data ??

    – pritesh
    Mar 23 at 15:41












  • 1





    What is the structure of contacts data ??

    – pritesh
    Mar 23 at 15:41







1




1





What is the structure of contacts data ??

– pritesh
Mar 23 at 15:41





What is the structure of contacts data ??

– pritesh
Mar 23 at 15:41












1 Answer
1






active

oldest

votes


















1














It is possible to sort contacts using Expo. It was added in August 2018. https://expo.canny.io/feature-requests/p/sorting-options-for-contacts



If you check the documentation you can see that getContactsAsync takes a ContactQuery.



ContactQuery (see here) takes a SortType (see here), allowing you to sort the contacts by either FirstName or LastName.



A simple example would be the following.



 const data: contacts = await Contacts.getContactsAsync( 
fields: [Contacts.Fields.PhoneNumbers],
sort: Contacts.SortTypes.FirstName
);


It is worth noting that at the current time, SortType is only available for Android. So for iOS you would need to sort them in the order you want, yourself.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315218%2fsorting-contacts-in-alphabetical-order-in-react-native%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    It is possible to sort contacts using Expo. It was added in August 2018. https://expo.canny.io/feature-requests/p/sorting-options-for-contacts



    If you check the documentation you can see that getContactsAsync takes a ContactQuery.



    ContactQuery (see here) takes a SortType (see here), allowing you to sort the contacts by either FirstName or LastName.



    A simple example would be the following.



     const data: contacts = await Contacts.getContactsAsync( 
    fields: [Contacts.Fields.PhoneNumbers],
    sort: Contacts.SortTypes.FirstName
    );


    It is worth noting that at the current time, SortType is only available for Android. So for iOS you would need to sort them in the order you want, yourself.






    share|improve this answer



























      1














      It is possible to sort contacts using Expo. It was added in August 2018. https://expo.canny.io/feature-requests/p/sorting-options-for-contacts



      If you check the documentation you can see that getContactsAsync takes a ContactQuery.



      ContactQuery (see here) takes a SortType (see here), allowing you to sort the contacts by either FirstName or LastName.



      A simple example would be the following.



       const data: contacts = await Contacts.getContactsAsync( 
      fields: [Contacts.Fields.PhoneNumbers],
      sort: Contacts.SortTypes.FirstName
      );


      It is worth noting that at the current time, SortType is only available for Android. So for iOS you would need to sort them in the order you want, yourself.






      share|improve this answer

























        1












        1








        1







        It is possible to sort contacts using Expo. It was added in August 2018. https://expo.canny.io/feature-requests/p/sorting-options-for-contacts



        If you check the documentation you can see that getContactsAsync takes a ContactQuery.



        ContactQuery (see here) takes a SortType (see here), allowing you to sort the contacts by either FirstName or LastName.



        A simple example would be the following.



         const data: contacts = await Contacts.getContactsAsync( 
        fields: [Contacts.Fields.PhoneNumbers],
        sort: Contacts.SortTypes.FirstName
        );


        It is worth noting that at the current time, SortType is only available for Android. So for iOS you would need to sort them in the order you want, yourself.






        share|improve this answer













        It is possible to sort contacts using Expo. It was added in August 2018. https://expo.canny.io/feature-requests/p/sorting-options-for-contacts



        If you check the documentation you can see that getContactsAsync takes a ContactQuery.



        ContactQuery (see here) takes a SortType (see here), allowing you to sort the contacts by either FirstName or LastName.



        A simple example would be the following.



         const data: contacts = await Contacts.getContactsAsync( 
        fields: [Contacts.Fields.PhoneNumbers],
        sort: Contacts.SortTypes.FirstName
        );


        It is worth noting that at the current time, SortType is only available for Android. So for iOS you would need to sort them in the order you want, yourself.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 23 at 16:48









        AndrewAndrew

        7,22241730




        7,22241730





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315218%2fsorting-contacts-in-alphabetical-order-in-react-native%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현