ModalComponentProp
Note: ModalComponentProp reuses the same types as ModalProp and only adds 4 more on top of them.
export type ModalComponentProp<
P extends ModalfyParams,
Props = unknown,
M = keyof P
> = Props & {
modal: UsableModalComponentProp<P, M>
}
// ------------------ INTERNAL TYPES ------------------ //
type ModalfyParams = { [key: string]: any }
interface UsableModalComponentProp<
P extends ModalfyParams,
M extends keyof P
> extends<UsableModalProp<P>> {
addListener: ModalListener
getParam: <N extends keyof P[M], D extends P[M][N]>(
paramName: N,
defaultValue?: D,
) => D extends P[M][N] ? P[M][N] : undefined
removeAllListeners: () => void
params?: P[M]
}
type ModalListener = (
eventName: 'onAnimate',
callback: (value?: number) => void,
) => ModalEventListener
type ModalEventListener = { remove: () => boolean }Unexpected error with integration github-files: Integration is not authenticated with GitHub
API reference
addListener
addListener Function that allows you to hook a listener to the animatedValue of the modal represented by the component you're in.
Example:
getParam
getParam Function that looks inside params and returns you the value of the key corresponding to paramName. Returns the provided defaultValue if nothing was found.
Example:
removeAllListeners
removeAllListeners Removes all the listeners connected to the modal component you're in.
Example:
params
params Optional params you provided when opening the modal you're in.
Example:
Last updated
Was this helpful?