Expo Contacts and Flatlist

#1

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.

0 Likes

#2

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/

0 Likes

#3

Thanks Charlie,

Here is my code https://snack.expo.io/H1Fd2DxHQ.
I’m trying to know how to load more contacts when I scroll down the list.

0 Likes

#4

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:

0 Likes

#5

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: https://medium.com/react-native-development/how-to-use-the-flatlist-component-react-native-basics-92c482816fe6

So the same think but with Expo contacts.

0 Likes

#6

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

0 Likes

#7

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.

0 Likes

#8

I don’t know where I’m wrong.

Could be better use ScrollView?

0 Likes

closed #9

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

0 Likes