react-native-phonebook
Version:
React Native library to launch phonebook/contacts app and return selected contact details
44 lines • 2.15 kB
TypeScript
import type { Contact, PhonebookOptions, PhonebookResult, PhonebookCallback } from './types';
/**
* Opens the native phonebook/contacts app and allows user to select contacts
* @param options Configuration options for the phonebook picker
* @returns Promise that resolves with the selected contact(s)
*/
export declare const openPhonebook: (options?: PhonebookOptions) => Promise<PhonebookResult>;
/**
* Simple contact picker that returns a single contact
* @returns Promise that resolves with the selected contact or null if cancelled
*/
export declare const pickContact: () => Promise<Contact | null>;
/**
* Opens the native phonebook/contacts app with a callback
* @param callback Function to call when contact selection is complete
* @param options Configuration options for the phonebook picker
*/
export declare const openPhonebookWithCallback: (callback: PhonebookCallback, options?: PhonebookOptions) => void;
/**
* Checks if the phonebook/contacts app is available on the device
* @returns Promise that resolves to true if available, false otherwise
*/
export declare const isPhonebookAvailable: () => Promise<boolean>;
/**
* Requests permission to access contacts
* @returns Promise that resolves to true if permission granted, false otherwise
*/
export declare const requestContactsPermission: () => Promise<boolean>;
/**
* Checks if the app has permission to access contacts
* @returns Promise that resolves to true if permission granted, false otherwise
*/
export declare const hasContactsPermission: () => Promise<boolean>;
export type { Contact, PhoneNumber, Email, Address, PhonebookOptions, PhonebookResult, PhonebookCallback, } from './types';
declare const _default: {
openPhonebook: (options?: PhonebookOptions) => Promise<PhonebookResult>;
pickContact: () => Promise<Contact | null>;
openPhonebookWithCallback: (callback: PhonebookCallback, options?: PhonebookOptions) => void;
isPhonebookAvailable: () => Promise<boolean>;
requestContactsPermission: () => Promise<boolean>;
hasContactsPermission: () => Promise<boolean>;
};
export default _default;
//# sourceMappingURL=index.d.ts.map