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

Understanding different parameters passed to Contacts.getContactsAsync in expo-contacts react-native

我在 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