了解在 expo-contacts react-native 中传递给 Contacts.getContactsAsync 的不同参数

问题描述

我在 react-native 中使用 expo-contacts 来获取联系方式。我刚刚开始并复制粘贴了用于这样做的代码。一切正常,但我不明白传递给 Contacts.getContactsAsync({pageSize: 1,offset: 0,fields: ['PHONE_NUMBER']}) 的参数。

请解释pageSize(我有点理解。我认为pageSize用于获取特定数量的联系人)、offsetfields(我认为fields是一种过滤方法,但不确定)。

解决方法

哦,在问这个问题几分钟后,现在我明白了。

这里是详细信息;

fields >> If available the fields defined will be returned. If nil then all fields will be returned.

pageSize >> The max number of contacts to return. If nil or 0 then all contacts will be returned.

offset >> The number of contacts to skip before gathering contacts.

这里有更多细节;

https://docs.expo.io/versions/latest/sdk/contacts/#contactquery

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...