Skip to content

CNContactPickerContactPropertyEvent ​

CNContactPickerContactPropertyEvent represents the user tapping one item, such as a phone number, in a contact's details in the system contact picker.

The contactpropertyselect event of CNContactPickerViewController is this class, and contactProperty is the item chosen.

It belongs to the @nacrejs/contacts package; for installation, see CNContactPickerViewController.

Inheritance: Event → CNContactPickerContactPropertyEvent

Constructor ​

CNContactPickerContactPropertyEvent()

Creates a CNContactPickerContactPropertyEvent. The runtime creates one itself when it fires the events below; app code can use it to build an event object and fire it with dispatchEvent() to try out a listener.

Instance properties ​

Also inherits the properties of Event; the most commonly used are type and target. The properties below are read-only; assigning to them throws TypeError.

PropertyDescription
contactProperty read-onlyThe item the user chose in the contact's details

These properties live on the prototype, not on the event object itself: Object.keys(event) and { ...event } don't include them, so read them one by one. See Events with fields.

Events that use this class ​

ObjectEvents
CNContactPickerViewControllercontactpropertyselect

It can't be canceled: cancelable is false, and preventDefault() has no effect. After it is fired, the system closes the picker.

Examples ​

js
const page = new UIViewController();
const picker = new CNContactPickerViewController();
picker.addEventListener('contactpropertyselect', (e) => {
  console.log(e instanceof CNContactPickerContactPropertyEvent);
});
page.presentViewController(picker, { animated: true });

Effect: after the user makes a choice in the picker, prints true. Not verified in the simulator.

Corresponding iOS API ​

ObjCJS
contactPicker:didSelectContactProperty:The contactpropertyselect event
The contactProperty parameterevent.contactProperty

See also ​