Expo Contacts and Flatlist

Hello everyone,

I’m trying to use Expo.Contacts with Flatlist. I have more less 1000 and I start my pageSize with 100 and the implementation show the first 100.

<FlatList
           keyExtractor={this._keyExtractor}
           renderItem={({ item }) =>
            <ListItem>
              <Text>{item.firstName}</Text>
            </ListItem>
           }
           onEndReachedThreshold={-1.5}
           data={contacts}
           onEndReached={this.loadAsync}
        />

But when I scroll down don’t show more contacts.
looks like that my loadAsync is not called again (after show the first contacts)

Anyone have experience with Contact Pagination and Flatlist.

Thanks.

It will be easier to help you if you post a Snack with your code that you are trying to make work. https://snack.expo.io/

Thanks Charlie,

Here is my code vigorous marshmallows - Snack.
I’m trying to know how to load more contacts when I scroll down the list.

Here is an example of what you are looking for: https://github.com/expo/native-component-list/blob/master/screens/Contacts/ContactsScreen.js in application it works pretty similar to the iOS contacts app :blue_heart:

Thanks for your reply Bacon but my code was based on this example.
In the examplo they have a button to go to the next contact but I want when I scroll down my code load more 100 contacts.

Like this: https://cdn-images-1.medium.com/max/800/1*GdDrkOb1RojXZefVa6JD-w.gif from this

From this tutorial: How to use the FlatList Component — React Native Basics | by Spencer Carli | React Native Development | Medium

So the same think but with Expo contacts.

This does all that same stuff! Just make sure you have enough contacts to paginate.

I already tried this.

I have 1000 contacts.
I tried lpage size with 100, 200 and 500.
I tried onEndReachedThreshold with -1.5, 0.5 and 1.

I put a alert to test and looks like that the code just wait render the contacts to call the alert and not I scroll down the list with my finger. So when my list reach the botton of the screen.

I don’t know where I’m wrong.

Could be better use ScrollView?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.