Dialog type you want to show on the screen
Note: this parameter is internally assigned to a ref
, so changing it will not cause any hooks
to re-run with its new value. This means that updating this parameter will not cause a new
callback to be returned. However, because of the nature of calling dialogs, this has no adverse
effect on the functionality of this hook. Calling the callback will always use the latest
dialogType
.
Various options for configuring the dialog that shows and this hook. If an
options
parameter is also provided to the returned showDialog
callback, those
callback-provided options
merge over these hook-provided options
Note: this parameter is internally assigned to a ref
, so changing it will not cause any hooks
to re-run with its new value. This means that updating this parameter will not cause a new
callback to be returned. However, because of the nature of calling dialogs, this has no adverse
effect on the functionality of this hook. Calling the callback will always use the latest
options
.
(response, dialogType, options)
The function that will be called if the
dialog request resolves properly
response
- the resolved value of the dialog call. Either the user's response or undefined
if
the user cancelsdialogType
- the value of dialogType
at the time that this dialog was calledoptions
the options
provided to the dialog at the time that this dialog was called. This
consists of the options
provided to the returned showDialog
callback merged over the
options
provided to the hook and additionally contains UseDialogCallbackOptions
propertiesNote: this parameter is internally assigned to a ref
, so changing it will not cause any hooks
to re-run with its new value. This means that updating this parameter will not cause a new
callback to be returned. However, because of the nature of calling dialogs, this has no adverse
effect on the functionality of this hook. When the dialog resolves, it will always call the
latest resolveCallback
.
(error, dialogType, options)
The function that will be called if the
dialog request throws an error
error
- the error thrown while calling the dialogdialogType
- the value of dialogType
at the time that this dialog was calledoptions
the options
provided to the dialog at the time that this dialog was called. This
consists of the options
provided to the returned showDialog
callback merged over the
options
provided to the hook and additionally contains UseDialogCallbackOptions
propertiesNote: this parameter is internally assigned to a ref
, so changing it will not cause any hooks
to re-run with its new value. This means that updating this parameter will not cause a new
callback to be returned. However, because of the nature of calling dialogs, this has no adverse
effect on the functionality of this hook. If the dialog throws an error, it will always call
the latest rejectCallback
.
showDialog(options?)
- callback to run to show the dialog to prompt the user for a
response
optionsOverrides?
- options
object you may specify that will merge over the options
you
provide to the hook before passing to the dialog. All properties are optional, so you may
specify as many or as few properties here as you want to overwrite the properties in the
options
you provide to the hookEnables using papi.dialogs.showDialog
in React more easily. Returns a callback to run that will
open a dialog with the provided dialogType
and options
then run the resolveCallback
with
the dialog response or rejectCallback
if there is an error. By default, only one dialog can be
open at a time.
If you need to open multiple dialogs and track which dialog is which, you can set
options.shouldOpenMultipleDialogs
to true
and add a counter to the options
when calling the
callback. Then resolveCallback
will be resolved with that options object including your
counter.
Dialog type you want to show on the screen
Note: this parameter is internally assigned to a ref
, so changing it will not cause any hooks
to re-run with its new value. This means that updating this parameter will not cause a new
callback to be returned. However, because of the nature of calling dialogs, this has no adverse
effect on the functionality of this hook. Calling the callback will always use the latest
dialogType
.
Various options for configuring the dialog that shows and this hook. If an
options
parameter is also provided to the returned showDialog
callback, those
callback-provided options
merge over these hook-provided options
Note: this parameter is internally assigned to a ref
, so changing it will not cause any hooks
to re-run with its new value. This means that updating this parameter will not cause a new
callback to be returned. However, because of the nature of calling dialogs, this has no adverse
effect on the functionality of this hook. Calling the callback will always use the latest
options
.
(response, dialogType, options)
The function that will be called if the
dialog request resolves properly
response
- the resolved value of the dialog call. Either the user's response or undefined
if
the user cancelsdialogType
- the value of dialogType
at the time that this dialog was calledoptions
the options
provided to the dialog at the time that this dialog was called. This
consists of the options
provided to the returned showDialog
callback merged over the
options
provided to the hook and additionally contains UseDialogCallbackOptions
propertiesNote: this parameter is internally assigned to a ref
, so changing it will not cause any hooks
to re-run with its new value. This means that updating this parameter will not cause a new
callback to be returned. However, because of the nature of calling dialogs, this has no adverse
effect on the functionality of this hook. When the dialog resolves, it will always call the
latest resolveCallback
.
showDialog(options?)
- callback to run to show the dialog to prompt the user for a
response
optionsOverrides?
- options
object you may specify that will merge over the options
you
provide to the hook before passing to the dialog. All properties are optional, so you may
specify as many or as few properties here as you want to overwrite the properties in the
options
you provide to the hook
Enables using
papi.dialogs.showDialog
in React more easily. Returns a callback to run that will open a dialog with the provideddialogType
andoptions
then run theresolveCallback
with the dialog response orrejectCallback
if there is an error. By default, only one dialog can be open at a time.If you need to open multiple dialogs and track which dialog is which, you can set
options.shouldOpenMultipleDialogs
totrue
and add a counter to theoptions
when calling the callback. ThenresolveCallback
will be resolved with that options object including your counter.